My setup is basically this: I have pointed two domains at my VPS running Ubuntu 10.04. I am using an nginx frontend and Apache running Django with mod-wsgi (not an issue, it works fine).
Nginx is proxying just fine and Apache does its job, but all requests are picked up by the first Virtualhost, even if the server_name is not supposed to match. So domain1.com and domain2.com are both giving me the same webpage. Grateful for any ideas/answers! If anything needs to be clarified, please let me know.
nginx server conf
server {
listen 80 default;
server_name domain1.com;
location / {
proxy_pass http://localhost:8001;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
listen 80;
server_name domain2.com;
location / {
proxy_pass http://localhost:8001;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
And the Apache conf:
NameVirtualHost *:8001
<VirtualHost *:8001>
ServerAdmin webmaster@localhost
ServerName domain1.com
ServerAlias www.domain1.com
...
</VirtualHost>
<VirtualHost *:8001>
ServerAdmin webmaster@localhost
ServerName domain2.com
ServerAlias www.domain2.com
...
</VirtualHost>