nginx反向代理同一ip多个域名,给header加上host就可以了
proxy_set_header Host $host;
nginx.conf例子
upstream mysvr {
server 127.0.0.1:8080;
}
server
{
listen 80;
server_name servera.c1gstudio.com;
index index.html index.htm index.php;
root /opt/htdocs/www;
location / {
proxy_pass http://mysvr;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server
{
listen 80;
server_name serverb.c1gstudio.com;
index index.html index.htm index.php;
root /opt/htdocs/www;
location / {
proxy_pass http://mysvr;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
学习一下。
俩域名指向同一个网站了?
说的是一IP多域名,是不是同一网站看你后端
请问用nginx 的blog主机头,反向代理apache 83端口下的虚拟目录 wordpress如何配置呢
proxy_pass http://192.168.0.10:83/wordpress;
可以试试,未经验证