赞
踩
Nginx 配置Https相关
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
keepalive_timeout 65;
server { listen 80; server_name www.xxxx.cn xxxx.cn; #域名可输入多个域名 中间用空格分开 rewrite ^(.*)$ https://www.xxxx.cn$request_uri; #重定向到htps下 # return 301 https://www.xxxx.cn$request_uri; } server { listen 443; server_name xxxx.cn; rewrite ^(.*)$ https://www.xxxx.cn$request_uri; #重定向到htps下 } # HTTPS server server { listen 443 default_server ssl; server_name www.xxxx.cn; #域名 ssl_certificate xxxx.pem; #证书 ssl_certificate_key xxxx.key;#证书 ssl_session_timeout 5m; client_max_body_size 20M; ##解决上传文件的大小受限的问题 ssl_protocols SSLv2 SSLv3 TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP; ssl_prefer_server_ciphers on; error_page 497 "https://$host$uri?$args"; #这是跳转Http请求到Https #访问前端项目 location / { alias D:/sygt_pc/web/; index index.html index.htm; } #调用后台 location /xx-api/ { proxy_pass http://127.0.0.1:8888/xx-api/; } # 调用第三方接口 location /bai/ { proxy_pass http://127.0.0.1:8888/; } # 配置404页面 需要在nginx目录下的html中放入404.html error_page 404 @fb; location @fb { rewrite ".*" http://127.0.0.1/404; break ; } location /404 { alias D:/javatools/nginx-1.18.0/html/; index 404.html 404.htm; } }
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。