在同一nginx服务器上使用SSL的两个域 - 443

问题描述 投票:0回答:0

/etc/nginx/sites-avialable/hello.com

server { server_name hello.com www.hello.com; location / { proxy_pass http://localhost:4000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } listen [::]:443 ssl ipv6only=on default_server; # managed by Certbot listen 443 ssl default_server; # managed by Certbot ssl_certificate /etc/letsencrypt/live/hello.com/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/hello.com/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot } server { if ($host = www.hello.com) { return 301 https://$host$request_uri; } # managed by Certbot if ($host = hello.com) { return 301 https://$host$request_uri; } # managed by Certbot listen 80 default_server; listen [::]:80 default_server; server_name hello.com www.hello.com; return 404; # managed by Certbot }

/etc/nginx/sites-abailable/example.com

server { server_name example.com www.example.com; location / { proxy_pass http://localhost:3000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } listen [::]:443 ssl ipv6only=on; # managed by Certbot listen 443 ssl; # managed by Certbot ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot } server { if ($host = www.example.com) { return 301 https://$host$request_uri; } # managed by Certbot if ($host = example.com) { return 301 https://$host$request_uri; } # managed by Certbot listen 80; listen [::]:80; server_name example.com www.example.com; return 404; # managed by Certbot }

我该怎么做才能避免此错误?非常感谢NGINX文件的进一步改进。

我使用了以下指南:
如何设置Nginx服务器块:

Https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-nginx-server-blocks-virtual-hosts-nosts-on-on-ubuntu-14-4-04--04-- lts

如何在Ubuntu 16.04上设置Node.js生产申请:

Https://www.digitalocean.com/community/community/tutorials/how-to-to-to-set-to-set-up-a-node-node-node-js-application-for-production-for-production -16-04

如何使用我们在Ubuntu上加密16.04:

https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-with-let-s-cen-cen-cen-cen-cen-con-en-ubuntu-16-04,

问题是

ipv6only=on,只能指定文档后才能指定。

默认值无论如何都是

on,因此可以安全地删除该选项。

node.js ubuntu ssl nginx digital-ocean
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.