Answer the question
In order to leave comments, you need to log in
ngnix + node config, to whom where and to whom?
Where to write something so that the application is simply at the URL address, and not at the URL: 3000 address.
I tried googled examples, nothing, it works for 3000, without it it just gives a list of files on the host ... in general, the question is - how to tell ngnix that app.js is the start page, and what to say to app.js so that it apparently makes friends with him.
I'm not a real welder, please don't kick me :)
Of course, I googled examples, but nothing helped, the ngnix config for the site didn't help me.
Yes, I asked the admins - the answer is: you are a cancer.
Answer the question
In order to leave comments, you need to log in
Use port 80, not 3000.
And here is an example config:
nginx/sites-available/default
server {
listen 80;
server_name example.com;
location / {
proxy_pass http://localhost:8080;
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;
}
}
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World');
}).listen(8080);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question