我目前有一个在 Nginx 上为 foo.domain.com 运行的虚拟主机,一切正常。
我为要添加的新子域创建了一个新文件,名为 bar.domain.com。我对两者使用相同的设置。
当我重新启动 Nginx 时,我得到
Restarting nginx: nginx: [warn] conflicting server name "" on 0.0.0.0:443, ignored nginx.
Run Code Online (Sandbox Code Playgroud)
当我访问 bar.domain.com 时,我看到了我应该看到的内容,但是当我访问 foo.domain.com 时,我看到了 bar.domain.com 链接到的页面。
富
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;
...
}
Run Code Online (Sandbox Code Playgroud)
酒吧
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 …Run Code Online (Sandbox Code Playgroud)