我有
server {
listen 80;
server_name domain1 domain2 domain3
location / {
proxy_pass http://127.0.0.1:8088;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_connect_timeout 120;
proxy_send_timeout 120;
proxy_read_timeout 180;
}
}
server {
listen domainX:80;
server_name domainX www.domainX
location / {
proxy_pass http://127.0.0.1:8088;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_connect_timeout 120;
proxy_send_timeout 120;
proxy_read_timeout 180;
}
location ~* \.(jpeg|jpg|gif|png|ico|bmp|swf|css|js)$ {
root domainXStaticRoot
}
# other options for domainX only
}
来自第一个服务器块nginx的域的仅返回根页面:
http://domain1 -> returns root page for domain1
http://domain1/style.css -> nginx trying return according location from server block two eg domainXStaticRoot/style.css
如果修改 听80; 至 listen domain1:80; 然后对于domain1一切正常,但我没有找到如何在listen指令中写多个域。
我的错误?