22
01月
2022
摘要:本文指导您如何在 Nginx 服务器中安装 SSL 证书。
- 下载服务器类型为 Nginx 证书,
love2where.com
证书文件包到本地目录。- 文件夹内容:
love2where.com_bundle.crt
证书文件love2where.com.key
私钥文件
- 文件夹内容:
- 拷贝上面的
love2where.com_bundle.crt和love2where.com.key文件到
Nginx 服务器的目录/etc/nginx/conf.d里面
编辑 Nginx 根目录下的 conf/nginx.conf
文件。修改内容如下:
- 说明:
- 此操作可通过执行
vim /usr/local/nginx/conf/nginx.conf
命令行编辑该文件。- 由于版本问题,配置文件可能存在不同的写法。例如:Nginx 版本为
nginx/1.15.0
以上请使用listen 443 ssl
代替listen 443
和ssl on
。
server {
listen 80;
listen 443;
ssl on;
ssl_certificate conf.d/love2where.com_bundle.crt;
ssl_certificate_key conf.d/love2where.com.key;
autoindex on;
ssl_session_timeout 5m;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;
server_name m.love2where.com www.love2where.com love2where.com;
root /www/netcore/uploads/;
index index.html index.htm;
access_log logs/access.log;
location ~ (.*) {
proxy_pass http://netcore$1?$query_string;
include naproxy.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
expires 30d;
}
location ~ .*\.(js|css)?$ {
expires 12h;
}
}3.在 Nginx 根目录下,通过执行以下命令验证配置文件问题。
非特殊说明,本文版权归HPay所有,转载请注明出处.
本文类型: Java工具