I have a static html site, and 2 node instances running on a server. Everything is working below for site1, but I cannot figure out how to modify the /static/ location so that site2 can access its own public directory.
root /home/username/;
index index.html index.htm index.nginx-debian.html;
server_name siteurl.com;
location / {
root /home/username/web/;
}
location /site1/ {
proxy_pass http://localhost:3000/site1/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
location /site2/ {
proxy_pass http://localhost:3001/site2/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
location /static/ {
proxy_pass http://localhost:3000$request_uri;
}