Nginx 服务器 SSL 证书安装部署配置https

我使用的是腾讯的云服务器,所以直接参考腾讯的官方文档很容易就实现了。详见文档:
https://cloud.tencent.com/document/product/400/35244

腾讯云服务器

步骤

申请证书

https://console.cloud.tencent.com/ssl

配置

按上面的文档配置即可了。
https://cloud.tencent.com/document/product/400/35244

部署完成无法访问

我第一次部署完成,发现无法访问了。我本以为443端口是默认开启的,所以连看都没看。最终发现,还是因为我的443端口没有开通导致的。
在这里插入图片描述

阿里云服务器

我不是服务器的管理员,具体怎么申请证书我没有操作。相关人员申请成功后给我提供了两个文件.pem.key。与腾讯的略有区别。
我的配置如下:

server {
    
       
		listen 443 ssl;
		server_name njslrxx.ycmit.cn;
		index index.html index.htm;
		ssl_certificate   D://phpstudy_pro//Extensions//Nginx1.15.11//conf//cert//8613904_njslrxx.ycmit.cn.pem;
		ssl_certificate_key  D://phpstudy_pro//Extensions//Nginx1.15.11//conf//cert//8613904_njslrxx.ycmit.cn.key;
		ssl_session_cache    shared:SSL:1m;
		ssl_session_timeout  5m;
		ssl_ciphers  HIGH:!aNULL:!MD5;
		ssl_prefer_server_ciphers  on;
         # Nginx config example
        location / {
    
    
                proxy_pass http://127.0.0.1:8098;
                proxy_http_version 1.1;
                proxy_read_timeout 300;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
                proxy_set_header Host $http_host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Real-PORT $remote_port;
        }
}

猜你喜欢

转载自blog.csdn.net/lxyoucan/article/details/127296930