nginx子目录绑定二级域名的方法

在服务器端我的博客是http://127.0.0.1:8080/blog下面的,我想通过nginx的反向代理到blog.codeif.com的域名下
比如原来文章的url是http://127.0.0.1:8080/blog/article/123
现在我想这么访问:http://blog.sifangke.com/article/123

 
server {
listen 80;
server_name blog.codeif.com;
location / {
rewrite ^/(.*)$ /blog/$1 last;
}

location ~* ^/blog/.*$ {
proxy_pass http://127.0.0.1:8080;
}
}

 

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片

    暂无评论内容