调试了很久。。。哦耶
共享出来吧
其实 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;
如果懒的配置头文件 就可以这么改。。呵呵