Запуск нескольких проектов на nodejs+nginx
Как запустить несколько проектов nodejs+nginx на одном сервере с разными портами?
server {
listen 80;
listen [::]:80;
server_name www.domain;
root /var/www/jor/html;
index index.html index.xml;
location /socket.io/ {
proxy_pass http://localhost:3000;
# the following is required for WebSockets
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header Port $server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
proxy_pass_request_headers on;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location = /robots.txt {
alias /var/www/jor/html/robots.txt;
}
}
const express = require('express');
const app = express();
const http = require('http');
const server = http.createServer(app);
const { Server } = require("socket.io");
const io = new Server(server);
io.on('connection', socket => {
io.on('connection', function(socket) {
socket.emit('hello', "eee");
});
})
//connection.end();
server.listen(3001, () => {
console.log('listening on *:3000');
});