diff --git a/group_vars/all.yml b/group_vars/all.yml index 521fd93..d15da04 100644 --- a/group_vars/all.yml +++ b/group_vars/all.yml @@ -85,8 +85,8 @@ apache_vhosts: ServerSignature Off ProxyTimeout 600 ProxyPassMatch ^/(.*\.php(/.*)?)$ "fcgi://127.0.0.1:9000/var/www/html/{{ server_hostname }}/$1" - LogFormat "%a %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined - CustomLog "/var/log/httpd/{{ server_hostname }}_access.log" combined + LogFormat "%a %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combinedlog + CustomLog "/var/log/httpd/{{ server_hostname }}_access.log" combinedlog ProxySet timeout=600 @@ -172,6 +172,18 @@ nginx_vhosts: access_log: "/var/log/nginx/{{ server_hostname }}_access.log" error_log: "/var/log/nginx/{{ server_hostname }}_error.log" extra_parameters: | + location ~ ^/sites/.*/files/styles/ { + try_files $uri @rewrite; + } + location ~ ^/sites/default/files/ { + try_files $uri @rewrite; + } + location ~* \.(gif|jpg|jpeg|png|ico|bmp|js|css|pdf|doc|webp|woff|ico|js|css|svg)(\?[a-zA-Z0-9\.\-_,])?$ { + expires max; + log_not_found off; + add_header Cache-Control "public"; + add_header X-Cache $upstream_cache_status; + } location = /favicon.ico { log_not_found off; access_log off; @@ -188,6 +200,7 @@ nginx_vhosts: proxy_set_header X-Forwarded-For $remote_addr; add_header X-Cache $upstream_cache_status; add_header X-Loaded "/"; + add_header X-Your-IP $remote_addr; } location ~ \.php$ { proxy_set_header X-Real-IP $remote_addr; @@ -196,6 +209,7 @@ nginx_vhosts: proxy_pass http://127.0.0.1:{{ apache_listen_port }}; add_header X-Cache $upstream_cache_status; add_header X-Loaded "php"; + add_header X-Your-IP $remote_addr; } location = /backup { deny all; @@ -207,18 +221,7 @@ nginx_vhosts: location ~ \..*/.*\.php$ { return 403; } - location ~ ^/sites/.*/files/styles/ { - try_files $uri @rewrite; - } - location ~ ^/sites/default/files/ { - try_files $uri @rewrite; - } - location ~* \.(gif|jpg|jpeg|png|ico|bmp|js|css|pdf|doc|webp|woff|ico|js|css|svg)(\?[a-zA-Z0-9\.\-_,])?$ { - expires max; - log_not_found off; - add_header Cache-Control "public"; - add_header X-Cache $upstream_cache_status; - } + location ~ /\. { access_log off; log_not_found off; diff --git a/roles/ansible-role-apache/templates/90-remoteip.conf.j2 b/roles/ansible-role-apache/templates/90-remoteip.conf.j2 index 981454d..f78d835 100644 --- a/roles/ansible-role-apache/templates/90-remoteip.conf.j2 +++ b/roles/ansible-role-apache/templates/90-remoteip.conf.j2 @@ -6,6 +6,5 @@ LogFormat "%a %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined RemoteIPHeader X-Real-IP - RemoteIPInternalProxy 127.0.0.1 - RemoteIPTrustedProxy 127.0.0.1 + RemoteIPInternalProxy 127.0.0.1/8