Welcome! Log In Create A New Profile

Advanced

404 when everything should be fine

Posted by Xeralis 
404 when everything should be fine
March 11, 2015 09:13AM
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?
Re: 404 when everything should be fine
March 16, 2015 10:54AM
I found the problem.

In the config of NGINX, there is an include to sites-enabled , and nothing to sites-avaible. So i had to do a symlink, and now it works :)
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 118
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready