Skip to content Skip to sidebar Skip to footer

Nginx Proxying Nodejs/express - 404 On Static Files

I have a setup with NginX which serves a php website off the root from /var/www and proxies Nodejs/Express on a particular subdirectory on my server. Here is the relevant configura

Solution 1:

If you want to access the static files through a different route, pass the route as the first argument :

You can use app.use('/static', express.static(__dirname + '/public'));

and a GET to http://server/static/css/main.css will serve main.css

Also if you want to serve static files through nginx this article is a good start: USING NGINX TO AVOID NODE.JS LOAD

Post a Comment for "Nginx Proxying Nodejs/express - 404 On Static Files"