Welcome! Log In Create A New Profile

Advanced

disable caching for single virtual host

absolutely_free@libero.it
April 11, 2016 07:14AM
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



_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

disable caching for single virtual host

absolutely_free@libero.it April 11, 2016 07:14AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 75
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready