分类: Linux
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


相关博文:

发表新评论