disable caching for single virtual host

absolutely_free at libero.it absolutely_free at libero.it
Mon Apr 11 11:12:03 UTC 2016


Hi,I am using nginx as reverse proxy cache with Apache.
Basically I use this configuration:
https://www.djm.org.uk/wordpress-nginx-reverse-proxy-caching-setup/

I need to exclude a specific virtual from nginx's cache.

So I added "shop" upstream with this configuration:
upstream backend {        ip_hash;        server 127.0.0.1:8080; # IP goes here.    }upstream shop {        ip_hash;        server 127.0.0.1:8081; # IP goes here.    }server {        listen 1.1.1.1; # IP goes here.        server_name virtual_host_without_cache.domain.org;        location / {            proxy_pass http://shop;        }        real_ip_header X-Forwarded-For;
        # Set proxy headers for the passthrough        proxy_set_header Host $host;        proxy_set_header X-Real-IP $remote_addr;        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;        #proxy_set_header X-Forwarded-For $remote_addr;}
server {        listen 1.1.1.1:80; # IP goes here.        server_name virtual_host_WITH_cache.domain.org; # IP could go here...........

Is it correct way to do this?I am still getting in http request header regarding caching when I get pages from  virtual_host_without_cache.domain.org:
HTTP/1.1 200 OK
Server: nginx/1.8.1
Date: Mon, 11 Apr 2016 11:00:59 GMT
Content-Type: image/jpeg
Content-Length: 65721
Connection: keep-alive
Last-Modified: Thu, 21 Jan 2016 16:59:08 GMT
ETag: "38292e-100b9-529db055b4f00"
Accept-Ranges: bytes
Expires: Tue, 12 Apr 2016 11:00:59 GMT
Cache-Control: max-age=86400

# nginx -vnginx version: nginx/1.8.1
# cat /etc/redhat-release CentOS release 6.7 (Final)
# httpd -vServer version: Apache/2.2.15 (Unix)Server built:   Mar 22 2016 19:03:53
Thank you



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20160411/e66b0f0e/attachment.html>


More information about the nginx mailing list