记录nginx反向代理配置
反向代理配置
server {
listen 80;
server_name localhost;
location /wx_bg {
root html;
proxy_pass http://localhost:8080/wx_bg;
index login.html;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 100m;
}
location /shop {
index index.html;
root /root/kangkang/;
}
location /img {
root /root/kangkang/;
}
}
server {
listen 443;
server_name localhost;
ssl on;
root html;
index index.html index.htm;
ssl_certificate cert/xx.pem;
ssl_certificate_key cert/xx.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;
location / {
root html;
index index.html index.htm;
}
location /wx_bg {
root html;
proxy_pass http://localhost:8080/wx_bg;
index login.html;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 100m;
}
location /shop {
index index.html;
root /root/kangkang/;
}
location /img {
root /root/kangkang/;
}
}
http 强制跳转 https 配置
server {
listen 80;
server_name localhost;
rewrite ^(.*)$ https://$host$1 permanent;
}
转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论,也可以邮件至 rockeycui@163.com
文章标题:记录nginx反向代理配置
文章字数:172
本文作者:崔石磊(RockeyCui)
发布时间:2018-08-10, 12:33:20
原始链接:https://cuishilei.com/nginx反向代理配置.html版权声明: "署名-非商用-相同方式共享 4.0" 转载请保留原文链接及作者。