Browse Source

Fix apache config

Ernesto Nicolás Carrea 5 years ago
parent
commit
8600590e65

+ 2 - 2
install/hst-install-centos.sh

@@ -1084,10 +1084,10 @@ if [ "$apache" = 'yes'  ]; then
     echo "(*) Configuring Apache Web Server..."
 
     # Copy configuration files
-    cp -f $HESTIA_INSTALL_DIR/apache2/apache2.conf /etc/httpd/conf/httpd.conf
+    cp -f $HESTIA_INSTALL_DIR/apache2/httpd.conf /etc/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
+    cp -f $HESTIA_INSTALL_DIR/logrotate/httpd /etc/logrotate.d/
 
     # Disable modules
     if [ -e "/etc/httpd/conf.modules.d/00-dav.conf" ]; then

+ 0 - 95
install/rhel/apache2/apache2.conf

@@ -1,95 +0,0 @@
-# It is split into several files forming the configuration hierarchy outlined
-# below, all located in the /etc/apache2/ directory:
-#
-#	/etc/apache2/
-#	|-- apache2.conf
-#	|	`--  ports.conf
-#	|-- mods-enabled
-#	|	|-- *.load
-#	|	`-- *.conf
-#	|-- conf.d
-#	|	`-- *
-
-# Global configuration
-PidFile ${APACHE_PID_FILE}
-Timeout 30
-KeepAlive Off
-MaxKeepAliveRequests 100
-KeepAliveTimeout 10
-
-<IfModule mpm_prefork_module>
-    StartServers          8
-    MinSpareServers       5
-    MaxSpareServers      20
-    ServerLimit         256
-    MaxClients          200
-    MaxRequestsPerChild 4000
-</IfModule>
-
-<IfModule mpm_worker_module>
-    StartServers          2
-    MinSpareThreads      25
-    MaxSpareThreads      75 
-    ThreadLimit          64
-    ThreadsPerChild      25
-    MaxClients          200
-    MaxRequestsPerChild 4000
-</IfModule>
-
-<IfModule mpm_event_module>
-    StartServers          2
-    MinSpareThreads      25
-    MaxSpareThreads      75 
-    ThreadLimit          64
-    ThreadsPerChild      25
-    MaxClients          200
-    MaxRequestsPerChild 4000
-</IfModule>
-
-# These need to be set in /etc/apache2/envvars
-User ${APACHE_RUN_USER}
-Group ${APACHE_RUN_GROUP}
-#User apache
-#Group apache
-
-AccessFileName .htaccess
-
-<Files ~ "^\.ht">
-    Order allow,deny
-    Deny from all
-    Satisfy all
-</Files>
-
-DefaultType None
-HostnameLookups Off
-
-ErrorLog ${APACHE_LOG_DIR}/error.log
-LogLevel warn
-
-# Include module configuration:
-Include mods-enabled/*.load
-Include mods-enabled/*.conf
-
-# Include list of ports to listen on and which to use for name based vhosts
-Include ports.conf
-
-LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
-LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
-LogFormat "%h %l %u %t \"%r\" %>s %O" common
-LogFormat "%{Referer}i -> %U" referer
-LogFormat "%{User-agent}i" agent
-LogFormat "%b" bytes
-
-Include conf.d/
-IncludeOptional conf.d/domains/*.conf
-
-# Include the virtual host configurations:
-#Include sites-enabled/
-
-ErrorDocument 403 /error/403.html
-ErrorDocument 404 /error/404.html
-ErrorDocument 500 /error/50x.html
-ErrorDocument 501 /error/50x.html
-ErrorDocument 502 /error/50x.html
-ErrorDocument 503 /error/50x.html
-ErrorDocument 506 /error/50x.html

+ 58 - 0
install/rhel/apache2/hestia.conf

@@ -0,0 +1,58 @@
+ServerRoot "/etc/httpd"
+Include conf.modules.d/*.conf
+User apache
+Group apache
+ServerAdmin root@localhost
+
+<Directory />
+    AllowOverride All
+</Directory>
+
+DocumentRoot "/var/www/html"
+<Directory "/var/www">
+    AllowOverride All
+    Require all granted
+</Directory>
+
+<Directory "/var/www/html">
+    Options Indexes FollowSymLinks
+    AllowOverride All
+    Require all granted
+</Directory>
+
+DirectoryIndex index.php index.html
+
+<Files ".ht*">
+    Require all denied
+</Files>
+
+ErrorLog "logs/error_log"
+LogLevel warn
+
+LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
+LogFormat "%h %l %u %t \"%r\" %>s %b" common
+LogFormat "%b" bytes
+CustomLog "logs/access_log" combined
+
+TypesConfig /etc/mime.types
+AddType application/x-compress .Z
+AddType application/x-gzip .gz .tgz
+AddType text/html .shtml
+AddOutputFilter INCLUDES .shtml
+#AddHandler cgi-script .cgi
+
+AddDefaultCharset UTF-8
+
+<IfModule mime_magic_module>
+    MIMEMagicFile conf/magic
+</IfModule>
+
+EnableSendfile on
+
+<IfModule remoteip_module>
+    RemoteIPHeader X-Real-IP
+    LogFormat "%a %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
+    LogFormat "%a %l %u %t \"%r\" %>s %b" common
+</IfModule>
+
+IncludeOptional conf.d/*.conf

+ 59 - 0
install/rhel/apache2/httpd.conf

@@ -0,0 +1,59 @@
+ServerRoot "/etc/httpd"
+Include conf.modules.d/*.conf
+User apache
+Group apache
+ServerAdmin root@localhost
+
+<Directory />
+    AllowOverride none
+</Directory>
+
+DocumentRoot "/var/www/html"
+<Directory "/var/www">
+    AllowOverride None
+    Require all granted
+</Directory>
+
+<Directory "/var/www/html">
+    Options Indexes FollowSymLinks
+    AllowOverride None
+    Require all granted
+</Directory>
+
+DirectoryIndex index.php index.html
+
+<Files ".ht*">
+    Require all denied
+</Files>
+
+ErrorLog "logs/error_log"
+LogLevel warn
+
+LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
+LogFormat "%h %l %u %t \"%r\" %>s %b" common
+LogFormat "%b" bytes
+CustomLog "logs/access_log" combined
+
+TypesConfig /etc/mime.types
+AddType application/x-compress .Z
+AddType application/x-gzip .gz .tgz
+AddType text/html .shtml
+AddOutputFilter INCLUDES .shtml
+#AddHandler cgi-script .cgi
+
+AddDefaultCharset UTF-8
+
+<IfModule mime_magic_module>
+    MIMEMagicFile conf/magic
+</IfModule>
+
+EnableSendfile on
+
+<IfModule remoteip_module>
+    RemoteIPHeader X-Real-IP
+    LogFormat "%a %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
+    LogFormat "%a %l %u %t \"%r\" %>s %b" common
+</IfModule>
+
+IncludeOptional conf.d/*.conf
+IncludeOptional conf.d/domains/*.conf

+ 0 - 19
install/rhel/logrotate/apache2

@@ -1,19 +0,0 @@
-/var/log/apache2/*.log /var/log/apache2/domains/*log {
-    rotate 4
-    weekly
-    missingok
-    notifempty
-    compress
-    delaycompress
-    create 640
-    sharedscripts
-    postrotate
-        /etc/init.d/apache2 reload > /dev/null || true
-        [ ! -f /var/run/nginx.pid ] || kill -USR1 `cat /var/run/nginx.pid`
-        endscript
-    prerotate
-        if [ -d /etc/logrotate.d/httpd-prerotate ]; then \
-        run-parts /etc/logrotate.d/httpd-prerotate; \
-        fi; \
-        endscript
-}

+ 10 - 0
install/rhel/logrotate/httpd

@@ -0,0 +1,10 @@
+/var/log/httpd/*log /var/log/httpd/domains/*log {
+    missingok
+    notifempty
+    compress
+    sharedscripts
+    postrotate
+        /sbin/service httpd reload > /dev/null 2>/dev/null || true
+        [ ! -f /var/run/nginx.pid ] || kill -USR1 `cat /var/run/nginx.pid`
+    endscript
+}