logico / vestacp-nodejs

Run automatically Node.JS apps in VestaCP.
114 stars 68 forks source link

Static files #14

Closed Novemburr closed 3 years ago

Novemburr commented 3 years ago

I have got the unix port working with pm2 nicely however my static files no longer appear to work.

Currently they are live on a different server like so:

app.use(express.static(path.join(__dirname, 'public')));

However that does not work through the unix port, or something else in the setup for vesta. Same node versions on both servers 12.20.0

On the version using the unix port I've tried a number of variations to the static path without much success in fact I'm somewhat confused at the rest of the application working. I cannot seem to navigate directly to the files in my public folder but the rest of the routes work as expected.

Novemburr commented 3 years ago

I've made some progress. Changing the location @fallback to be:

    location @fallback {
        #old line: proxy_pass      http://unix:/home/admin/web/domain.com/nodeapp/app.sock:/$1;
        proxy_pass      http://unix:/home/admin/web/domain.com/nodeapp/app.sock:/$request_uri;
    }

causes the public files to be shown correctly although I am not sure if relying on the fallback is the right way to go about this but if it works it works.