From 5bfd4ea15c989795263fd0385874c445af5a0c75 Mon Sep 17 00:00:00 2001 From: Ivan Grynenko Date: Wed, 6 Jul 2016 10:42:03 +1000 Subject: [PATCH] Fixing Nginx proxy. --- group_vars/all.yml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/group_vars/all.yml b/group_vars/all.yml index 17eb14f..4b4af27 100644 --- a/group_vars/all.yml +++ b/group_vars/all.yml @@ -171,15 +171,20 @@ nginx_vhosts: access_log off; } location / { - index index.php; - try_files $uri $uri/ /index.php; - expires max; + proxy_pass http://127.0.0.1:{{ apache_listen_port }}; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $remote_addr; + add_header X-Cache $upstream_cache_status; + add_header X-Loaded "/"; } location ~ \.php$ { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header Host $host; proxy_pass http://127.0.0.1:{{ apache_listen_port }}; + add_header X-Cache $upstream_cache_status; + add_header X-Loaded "php"; } location = /backup { deny all; @@ -216,3 +221,8 @@ nginx_vhosts: location ~ /\.ht { deny all; } + location @rewrite { + # Some modules enforce no slash (/) at the end of the URL + # Else this rewrite block wouldn't be needed (GlobalRedirect) + rewrite ^/(.*)$ /index.php?q=$1 last; + }