//http
const express = require('express');
const server = require('http')
var app = express();
var server = server.Server(app);
server.listen(3000);
//socket
Socket.io = require('socket.io')(3001, { path: '/', });
# Для стандартных пост гет запросов (запросы, естественно, будут на site/api/)
location /api/ {
expires $expires;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 30m;
proxy_connect_timeout 30m;
send_timeout 30m;
proxy_pass http://127.0.0.1:3000/; # set the adress of the Node.js instance here
}
# Для сокетов
location /socket/ {
expires $expires;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade; #для сокетов
proxy_set_header Connection "upgrade"; #для сокетов
proxy_http_version 1.1;
proxy_read_timeout 30m;
proxy_connect_timeout 30m;
send_timeout 30m;
proxy_pass http://127.0.0.1:3001; # set the adress of the Node.js instance here
# proxy_ssl_server_name on;
}