Nginx 配置https
2021-05-14 10:29
标签:location listen md5 time 准备 code 重载 域名 tls 1、准备好网站域名的https证书,后缀名如下,上传到服务器上。 2、配置nginx.conf 3、重载nginx服务器 Nginx 配置https 标签:location listen md5 time 准备 code 重载 域名 tls 原文地址:https://www.cnblogs.com/irobotzz/p/11990734.html xxx.pem xxx.key
server {
listen 443 ssl;
server_name scm.xxx.com;
ssl on;
ssl_certificate ./cert/cert.pem;#证书pem位置
ssl_certificate_key ./cert/cert.key;#证书key的路径
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
#禁止访问WEB-INF目录
location ^~ /(WEB-INF)/ {
deny all;
}
#配置代理路径
location / {
proxy_pass http://127.0.0.1:8080/scm/;
proxy_cookie_path /scm/ /;
}
#静态资源访问
location ~ \.(txt) {
root /usr/local/tomcat9/webapps/scm;
autoindex on;
}
}
}
到 nginx/sbin 目录下执行如下命令即可
./nginx -s reload