Browse Source

Fix configure apache

Ernesto Nicolás Carrea 5 years ago
parent
commit
38ecd43f42

+ 36 - 18
install/hst-install-centos.sh

@@ -1083,29 +1083,47 @@ fi
 if [ "$apache" = 'yes'  ]; then
     echo "(*) Configuring Apache Web Server..."
 
-    cp -f $HESTIA_INSTALL_DIR/httpd/httpd.conf /etc/httpd/conf/
-    cp -f $HESTIA_INSTALL_DIR/httpd/status.conf /etc/httpd/conf.d/
-    cp -f $HESTIA_INSTALL_DIR/httpd/ssl.conf /etc/httpd/conf.d/
-    cp -f $HESTIA_INSTALL_DIR/httpd/ruid2.conf /etc/httpd/conf.d/
-    cp -f $HESTIA_INSTALL_DIR/logrotate/httpd /etc/logrotate.d/
+    # Copy configuration files
+    cp -f $HESTIA_INSTALL_DIR/apache2/apache2.conf /etc/httpd/conf/httpd.conf
+    cp -f $HESTIA_INSTALL_DIR/apache2/status.conf /etc/httpd/conf.d/
+    cp -f $HESTIA_INSTALL_DIR/apache2/hestia-event.conf /etc/httpd/conf.modules.d/
+    cp -f $HESTIA_INSTALL_DIR/logrotate/apache2z /etc/logrotate.d/httpd
+
+    # Disable modules
     if [ -e "/etc/httpd/conf.modules.d/00-dav.conf" ]; then
         cd /etc/httpd/conf.modules.d
-        sed -i "s/^/#/" 00-dav.conf 00-lua.conf 00-proxy.conf
+        sed -i "s/^/#/" 00-dav.conf
     fi
-    echo > /etc/httpd/conf.d/hestia.conf
-    cd /var/log/httpd
-    touch access_log error_log suexec.log
-    chmod 640 access_log error_log suexec.log
-    chmod -f 777 /var/lib/php/session
-    chmod a+x /var/log/httpd
+    if [ -e "/etc/httpd/conf.modules.d/00-lua.conf" ]; then
+        cd /etc/httpd/conf.modules.d
+        sed -i "s/^/#/" 00-lua.conf 00-proxy.conf
+    fi
+    if [ -e "/etc/httpd/conf.modules.d/00-proxy.conf" ]; then
+        cd /etc/httpd/conf.modules.d
+        sed -i "s/^/#/" 00-proxy.conf
+    fi
+
+    if [ "$phpfpm" = 'yes' ]; then
+        # Disable prefork and php, enable event
+        # FIXME: a2dismod php$fpm_v > /dev/null 2>&1
+        sed -i "/LoadModule mpm_prefork_module/ s/^/#/" /etc/httpd/conf.modules.d/00-mpm.conf
+        sed -i "/LoadModule mpm_event_module/ s/#*//" /etc/httpd/conf.modules.d/00-mpm.conf
+    else
+        # apache_module_enable 'ruid2'
+    fi
+
+    mkdir -p /etc/httpd/conf.d/domains
+    echo "# Powered by hestia" > /etc/httpd/conf.d/welcome.conf
+
     mkdir -p /var/log/httpd/domains
+    chmod a+x /var/log/httpd
+    chmod 640 /var/log/httpd/access.log /var/log/httpd/error.log
     chmod 751 /var/log/httpd/domains
-    if [ "$release" -ge 7 ]; then
-        mkdir -p /etc/systemd/system/httpd.service.d
-        cd /etc/systemd/system/httpd.service.d
-        echo "[Service]" > limits.conf
-        echo "LimitNOFILE=500000" >> limits.conf
-    fi
+    chmod -f 777 /var/lib/php/session
+
+    # Not needed. status.conf is fixed.
+    # sed -i '/Allow from all/d' /etc/apache2/mods-enabled/status.conf
+
     systemctl enable httpd
     systemctl start httpd >> $LOG
     check_result $? "httpd start failed"

+ 5 - 0
install/rhel/apache2/hestia-event.conf

@@ -0,0 +1,5 @@
+<IfModule mpm_event_module>
+    <FilesMatch \.php$>
+        SetHandler "proxy:fcgi://127.0.0.1:9000"
+    </FilesMatch>
+</IfModule>

+ 1 - 1
install/rhel/apache2/status.conf

@@ -4,5 +4,5 @@ Listen 127.0.0.1:8081
     Order deny,allow
     Deny from all
     Allow from 127.0.0.1
-    Allow from all
+#    Allow from all
 </Location>