I currently have a vhost running on Nginx for foo.domain.com and everything works great.
I created a new file for a new sub-domain I want to add called bar.domain.com. I use the same settings for both.
When I restart Nginx I get
Restarting nginx: nginx: [warn] conflicting server name "" on 0.0.0.0:443, ignored nginx.
When I go to bar.domain.com I see what I am supposed to see, but when I go to foo.domain.com I see the page that bar.domain.com links to.
Foo
upstream php-handler {
server unix:/var/run/php5-fpm.sock;
}
server {
listen 80;
server_name foo.domain.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443;
ssl on;
ssl_certificate [path_foo]/cacert.pem;
ssl_certificate_key [path_foo]/privkey.pem;
root [path]/foo;
...
}
Bar
server {
listen 80;
server_name bar.domain.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443;
ssl on;
ssl_certificate [path_bar]/cacert.pem;
ssl_certificate_key [path_bar]/privkey.pem;
root [path]/bar;
}
Where am I going wrong?