Sup - I'm using Nginx to serve an Apache backend running multiple Vhosts on the same IP. Basically it works, still Nginx serves content for the first Vhost also for the second one and vise versa.
Nginx running in a Jail on 127.0.10.1 - Apache on 127.0.20.1.
Related configuration:
proxy_cache_path /tmp/site_aw levels=1:2 keys_zone=FIRST:75m inactive=24h max_size=1g;
proxy_cache_path /tmp/site_ptb levels=1:2 keys_zone=SECOND:75m inactive=2 4h max_size=1g;
Then the server configurations:
server {
listen 127.0.10.1:3128;
server_name proxy.example.com;
location / {
proxy_cache FIRST;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://127.0.20.1:80;
}
}
server {
listen 127.0.10.1:3128;
server_name proxy.othersite.com;
location / {
proxy_cache FIRST;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://127.0.20.1:80;
}
}
Well - this works though the second cache directory is never filled with anything. Also opening www.othersite.com opens the index of www,example.com. Opening unique content (for both domains) gets the content served without problems though.