# Disable caching for single virtual host

**URL:** <https://www.ruby-forum.com/t/disable-caching-for-single-virtual-host/244442>\
**Category:** NGINX\
**Created:** [April 11, 2016, 1:12pm UTC](https://www.ruby-forum.com/t/disable-caching-for-single-virtual-host/244442 "2016-04-11T13:12:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sadaf\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@Sadaf\_N](https://www.ruby-forum.com/u/Sadaf_N)\
**Post date:** [April 11, 2016, 1:12pm UTC](https://www.ruby-forum.com/t/disable-caching-for-single-virtual-host/244442/1 "2016-04-11T13:12:45Z")

</div>

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/](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](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
