SSL证书在线检测工具:https://csr.chinassl.net/ssl-checker.html
- .key文件:证书的私钥文件(申请证书时如果没有选择自动创建CSR,则没有该文件)
- .pem扩展名的证书文件采用Base64-encoded的PEM格式文本文件,可根据需要修改扩展名。
#启动443端口,配置ssl,使https生效
server {
listen 443 ssl ;
ssl_certificate /etc/nginx/ssl/6379197_www.lj0503.top.pem;
ssl_certificate_key /etc/nginx/ssl/6379197_www.lj0503.top.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 10m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
#默认监听80端口。可直接使用公网ip或域名访问80端口的项目,而不必加上80端口号
server {
listen 80;
location / {
root /opt/git_uniapp_koa2_mongoose/dist;
# index index.html index.htm; #默认访问路径
try_files $uri $uri/ /index.html;
}
location /api {
rewrite ^.+api/?(.*)$ /$1 break;
proxy_pass https://lj0503.top:4004;
}
error_page 404 /404.html;
location = /40x.html {
}
}