11
#Nginx 使用proxy_pass做反向代理的几条建议
source link: https://xmanyou.com/nginx-proxy-guide/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
15 September 2021
/ Nginx
#Nginx 使用proxy_pass做反向代理的几条建议
- 1). proxy_pass中,目标服务器不带path
proxy_pass http://<目标服务器>:<端口>
- 2). 使用rewrite来重写新路径
rewrite ^ $request_uri;
# 自动补充index.html
rewrite ^/$ /index.html;
# 补齐真正的路径
rewrite ^/(.*)$ /newpath/$1 break;
- 3). 即使路径一致也要用rewrite重写,避免二次转义
- 4). 使用proxy_intercept_errors捕获错误,避免目标服务器暴露
阿斌
Read more posts by this author.
扫一扫关注微信公众号:耿直的IT男阿斌
聊一聊IT男眼中的世界
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK