nginx for windows 配置多域名反向代理

调试了很久。。。哦耶

共享出来吧

其实 nginx反向代理同一ip多个域名,给header加上host就可以了

upstream test.test.cn {
server 119.75.216.20:80;
}

server {
listen 80;
server_name localhost;
server_name test.test.cn;
server_name test2.test.cn;

#charset koi8-r;

#access_log logs/host.access.log main;

location / {
root html;
index index.html index.htm;
proxy_pass http://test.test.com;
proxy_set_header host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
index index.html index.htm index.php;
}

这里 index index.html index.htm index.php;

也可以写成 proxy_redirect default;

如果懒的配置头文件 就可以这么改。。呵呵

原文链接:https://blog.csdn.net/weixin_30363981/article/details/96841273?ops_request_misc=&request_id=e1c32f2554f345eb95fcc6b6951069a6&biz_id=&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~koosearch~default-4-96841273-null-null.268%5Ev1%5Econtrol&utm_term=%E7%BE%A4%E6%99%96%E3%80%81%E5%9F%9F%E5%90%8D%E6%B3%A8%E5%86%8C%E3%80%81%E5%AE%9D%E5%A1%94%E3%80%81%E5%8F%8D%E5%90%91%E4%BB%A3%E7%90%86%E3%80%81%E9%BB%91%E7%BE%A4%E6%99%96%E3%80%81

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享