I cant seem to figure out what I am doing wrong with this simple bit of setup so I setup a node app (super simple to test things out) which looks like this:
// import express
const express = require('express');
// create new express app and assign it to `app` constant
const app = express();
// server port configuration
const PORT = 3000;
// create a route for the app
app.get('/', (req, res) => {
res.send('Hello this seems to work!');
});
// server starts listening the `PORT`
app.listen(PORT, () => {
console.log(`Server running at: http://localhost:${PORT}/`);
});
and my nginx server config looks something like this
server {
listen 80;
server_name www.example.org;
#add in ssh details here later
#These lines create a bypass for certain pathnames
#www.example.com/test.js is now routed to port 3000
#instead of port 80
location ~* \.(js)$ {
proxy_pass http://localhost:3000;
# proxy_set_header Host $host;
}
}
now according to me when I run this - nginx should redirect to express always yes? but I keep seeing the welcome to nginx page when I go to the website - not "Hello this seems to work!"
I was following this page since it had a similar case of static files and such as me Express + Nginx. Can't serve static files