High Traffic spikes
-
@esteban-constante yes using Nginx to serve static assets would absolutely help.
-
@julian Just checked my nginx conf, it's basically the same as the one in the tutorial:
upstream io_nodes { ip_hash; server 127.0.0.1:4567; server 127.0.0.1:4568; server 127.0.0.1:4569; } > server { listen 80; server_name community.nodebb.org; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; proxy_redirect off; # Socket.io Support proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; gzip on; gzip_min_length 1000; gzip_proxied off; gzip_types text/plain application/xml text/javascript application/javascript application/x-javascript text/css application/json; location @nodebb { proxy_pass http://io_nodes; } location ~ ^/assets/(.*) { root /path/to/nodebb/; try_files /build/public/$1 /public/$1 @nodebb; } location /plugins/ { root /path/to/nodebb/build/public/; try_files $uri @nodebb; } location / { proxy_pass http://io_nodes; } }
So yeah, it seems I'm using nginx to serve static assets
(ninja'd by yariplus)
-
Could you provide your full actual nginx config? Fell free to redact anything you think is sensitive.
Check the headers on a request to
example.com/assets/nodebb.min.js
. If nginx is set up correctly, they shouldn't have anX-Powered-By: NodeBB
header. -
Here it's the conf file:
upstream io_nodes { ip_hash; server 127.0.0.1:4567; server 127.0.0.1:4568; server 127.0.0.1:4569; server 127.0.0.1:4570; server 127.0.0.1:4571; server 127.0.0.1:4572; server 127.0.0.1:4573; server 127.0.0.1:4574; #16 cores: server 127.0.0.1:4575; server 127.0.0.1:4576; server 127.0.0.1:4577; server 127.0.0.1:4578; server 127.0.0.1:4579; server 127.0.0.1:4580; server 127.0.0.1:4581; server 127.0.0.1:4582; } server { listen 80; server_name myserver.tld; return 301 http://www.myserver.tld$request_uri; } server { listen 80; server_name www.myserver.tld; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; proxy_redirect off; # Socket.io Support proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; gzip on; gzip_min_length 1000; gzip_proxied off; gzip_types text/plain application/xml text/javascript application/javascript application/x-javascript text/css application/json; location @nodebb { proxy_pass http://io_nodes; } location ~ ^/assets/(.*) { root /home/myuser/nodebb/; try_files /build/public/$1 /public/$1 @nodebb; } location /plugins/ { root /home/myuser/nodebb/build/public/; try_files $uri @nodebb; } location / { proxy_pass http://io_nodes; } }
-
@esteban-constante please use triple ticks (```) around code blocks, not quotes. For future reference
-
@esteban-constante have you been able to check the response headers for any static assets yet? Your nginx file looks good to me. Have you tried running with fewer NodeBB processes? It could be that your database server is being overloaded.