I have a fullstack node express which serve static files and the api running on port 5000.
my nginx config is :
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
server_name mycoolserver.com;
location / {
try_files $uri $uri/ =404;
}
}
server {
listen 80;
listen [::]:80;
server_name fancyapp.mycoolserver.com;
location / {
proxy_pass http://127.0.0.1:5000/;
}
}
I can load the index.html at http://fancyapp.mycoolserver.com
but the css and js from this file failed to be loaded.
If I try to access some of the api, eg: http://fancyapp.mycoolserver.com/birds
, it's working.
I've read countless stackoverflow posts and google it for days without success.