我目前在Nginx上为foo.domain.com运行了一个vhost,一切都很好.
我为要添加的新子域创建了一个名为bar.domain.com的新文件.我对两者使用相同的设置.
当我重新启动Nginx时,我得到了
Restarting Nginx: Nginx: [warn] conflicting server name "" on 0.0.0.0:443,ignored Nginx.
当我去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;
...
}
酒吧
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;
}
我哪里错了?
在我看来,你的https块也需要指定服务器名称
例如
原文链接:https://www.f2er.com/nginx/435374.html例如
server {
listen 443;
server_name bar.domain.com;
ssl on;
ssl_certificate [path_bar]/cacert.pem;
ssl_certificate_key [path_bar]/privkey.pem;
root [path]/bar;
}