I have
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
}
}
for domains from the first server block, nginx returns only the root page:
http://domain1 -> returns root page for domain1
http://domain1/style.css -> nginx trying return according location from server block two eg domainXStaticRoot/style.css
If change, listen to 80; in listen domain1: 80; then for domain1 everything works fine, but I did not find how to write multiple domains in the listen directive.
where is my mistake
source
share