@@ -20,9 +20,45 @@ source /usr/local/hestia/conf/hestia.conf
2020
2121# ###### Place additional commands below. #######
2222
23- # Remove global options from nginx.conf to prevent conflicts with other web packages
24- if [ -e /etc/nginx/nginx.conf ] ; then
25- echo " (*) Updating nginx configuration.. "
26- sed -i " /add_header X-Frame-Options SAMEORIGIN;/d " / etc/nginx/nginx .conf
27- sed -i " /add_header X-Content-Type-Options nosniff;/d " /etc/nginx/nginx .conf
23+ # Update Apache and Nginx configuration to support new file structure
24+ echo " (*) Updating web server configuration... "
25+ if [ -f /etc/apache2/apache.conf ] ; then
26+ mv / etc/apache2/apache .conf $HESTIA_BACKUP /conf/
27+ cp -f $HESTIA /install/deb/apache2/apache.conf /etc/apache2/apache .conf
2828fi
29+ if [ -f /etc/nginx/nginx.conf ]; then
30+ mv /etc/nginx/nginx.conf $HESTIA_BACKUP /conf/
31+ cp -f $HESTIA /install/deb/nginx/nginx.conf /etc/nginx/nginx.conf
32+ fi
33+
34+ # Generate dhparam
35+ if [ ! -e /etc/ssl/dhparam.pem ]; then
36+ mv /etc/nginx/nginx.conf $HESTIA_BACKUP /conf/
37+ cp -f $hestiacp /nginx/nginx.conf /etc/nginx/
38+
39+ # Copy dhparam
40+ cp -f $hestiacp /ssl/dhparam.pem /etc/ssl/
41+
42+ # Update DNS servers in nginx.conf
43+ dns_resolver=$( cat /etc/resolv.conf | grep -i ' ^nameserver' | cut -d ' ' -f2 | tr ' \r\n' ' ' | xargs)
44+ for ip in $dns_resolver ; do
45+ if [[ $ip =~ ^[0-9]+\. [0-9]+\. [0-9]+\. [0-9]+$ ]]; then
46+ resolver=" $ip $resolver "
47+ fi
48+ done
49+ if [ ! -z " $resolver " ]; then
50+ sed -i " s/1.0.0.1 1.1.1.1/$resolver /g" /etc/nginx/nginx.conf
51+ fi
52+
53+ # Remove global options from nginx.conf to prevent conflicts with other web packages
54+ if [ -e /etc/nginx/nginx.conf ]; then
55+ sed -i " /add_header X-Frame-Options SAMEORIGIN;/d" /etc/nginx/nginx.conf
56+ sed -i " /add_header X-Content-Type-Options nosniff;/d" /etc/nginx/nginx.conf
57+ fi
58+
59+ # Restart Nginx service
60+ systemctl restart nginx > /dev/null 2>&1
61+ fi
62+
63+
64+
0 commit comments