@djcyry So we run it behind a reverse proxy too. Here's the config:
HTTP (file include)
server {
listen 80;
server_name www.social.example.com social.example.com;
return 301 https://social.example.com$request_uri;
}
HTTPS (file include)
server {
listen 443 ssl;
server_name www.social.example.com social.example.com;
ssl_certificate /etc/nginx/ssl/example.crt;
ssl_certificate_key /etc/nginx/ssl/example.key;
# SSL caching override
ssl_session_cache shared:SSL:10m;
# Enable long duration HSTS
add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload";
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_set_header Host $http_host;
proxy_redirect off;
#proxy_next_upstream off;
# Socket.IO Support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
include /var/www/social.example.com/conf/error.conf;
location @nodebb {
proxy_pass http://io_nodes;
}
location ~ ^/(images|language|sounds|templates|uploads|vendor|src\/modules|nodebb\.min\.js|stylesheet\.css|admin\.css) {
root /srv/http/domain/example.com/social/public/;
try_files $uri $uri/ @nodebb;
}
location / {
# These need to be defined in the location block to
# override express status message handler
error_page 404 /404.html;
error_page 502 /502.html;
error_page 503 /503.html;
proxy_intercept_errors on;
client_max_body_size 10M;
proxy_pass http://io_nodes;
}
}
Also the following upstream (2 workers):
upstream io_nodes {
server 127.0.1.4:4567;
server 127.0.1.4:4568;
}
Finally, also a upstream loopback in /etc/hosts
127.0.1.4 nbb.node.example.com
Note that we defined both server names, www.social.example.com
and social.example.com