为什么Nginx服务于不属于该域的域?

时间:2018-06-25 06:03:20

标签: nginx nginx-location

我在nginx中有此配置...

domain1.com(http,https) domain2.com(仅适用于http)

server {
    listen 443 ssl;
    server_name domain1.com;

    ssl_certificate      /location/of/ssl/domain1.com/fullchain.pem;
    ssl_certificate_key  /location/of/ssl/domain1.com/privkey.pem;

    location / {
        proxy_pass http://unix:/app/app.sock;
    }
}

# https redirect
server {
    listen 80;
    server_name domain1.com;
    return 301 https://$host$request_uri;
}

# only http (never https)
server {
    listen 80;
    server_name domain2.com;
    root /home/herberthobregon;
}

我期望的行为是:

http://domain1.com ---> https://domain1.com(nginx正确地做到了)

https://domain1.com ---> https://domain1.com(nginx正确地做到了)

http://domain2.com ---> http://domain2.com(nginx正确地做到了)

但是...

  

https://domain2.com --->显示(带有镀铬警告SSL )-> https://domain1.com的内容   ( nginx不能正确显示

     

,我希望他不要加载任何东西或显示错误

0 个答案:

没有答案