Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

404 when everything should be fine

$
0
0
Hello Nginx community,

I did several configurations of Nginx, but actually I can t manage to finish one on a new VPS of mine.

I use NodeJS as server, a simple hello world with node, which work perfectly when i do "node server.js" or "pm2 start server.js"
my default port for ssh is not 22 but 822 and i did the iptable so everything works fine with that new port.

my tree is like this : /var/www/xeralis/server.js

my /etc/nginx/sites-avaible/xeralis is like this :

server {
listen 80;

server_name xeralis.eu;

location / {
proxy_pass http://xeralis.eu:81;
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;
}
}

I want Nginx to listen on 80, and to proxy it to port 81, which is the port where my server.js listen to.

here the simple server.js

ar http = require('http');

http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(81);


What do i forgot here?

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>