Nginx使用proxy_pass及rewrite使用二级目录请求
实现效果:访问http://www.abc.com/artH5目录,即可请求到http://192.168.120.241:8080的内容,nginx上添加如下配置:
location ~* ^/artH5.*$ {
include deny.conf;
rewrite ^/artH5/(.*) /$1 break; #处理artH5多余的路由,实现根目录请求源地址效果
proxy_pass http://192.168.120.241:8080;
include proxy.conf;
error_log logs/artH5_error.log info;
access_log logs/artH5_access.log main;
}
reload即可;
nginx更多说明参考:
https://xuexb.com/post/nginx-url-rewrite.html
http://seanlook.com/2015/05/17/nginx-location-rewrite
Tag标签:「nginx 目录 rewrite proxy_pass」更新时间:「2021-11-04 14:33:12」阅读次数:「785」