我意识到这看起来至少是其他一些问题的重复,但是我已经阅读了几次,但仍在做错事。
以下是位于myexample.com nginx配置文件中的内容/etc/nginx/sites-available
。
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name myexample.com www.myexample.com;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
ssl_certificate /etc/letsencrypt/live/myexample.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/myexample.com/privkey.pem;
#Configures the publicly served root directory
#Configures the index file to be served
root /var/www/myexample.com;
index index.html index.htm;
}
它有效,当我转到https://myexample.com时,将提供内容并且连接是安全的。因此,此配置似乎很好。
现在,如果我将ssl端口更改为9443并重新加载nginx配置,则该配置将重新加载而没有错误,但是访问https://myexample.com时浏览器将显示错误(无法访问该网站/ myexample.com拒绝了连接。ERR_CONNECTION_REFUSED)
我在这里,这里和这里(以及其他地方)尝试过建议和文档,但是我总是收到ERR_CONNECTION_REFUSED错误。
我应该注意,我可以使用非标准端口,然后在URL中明确键入该端口,例如https://myexample.com:9443。但是我不想那样做。我想要的是用户能够在任何浏览器中键入myexample.com并使nginx自动重定向到安全连接。
同样,使用标准443 SSL端口时,我也没有任何问题。
编辑:我在debian / jessie上使用nginx / 1.6.2