node.jsnetwork-programmingnginxsocket.ionodebb

NodeBB horribly slow over Nginx reverse proxy


I'm running NodeBB behind an Nginx reverse proxy, and i'm experiencing load times over 10 seconds occasionally, otherwise average 2 second load time (still way too much). It should also be noted that the load time is about 200ms in total when i access the forum on the port NodeBB is running on, but i shouldn't need to do that.

I cannot for the life of me figure out why this reverse proxy is as slow as it is.

If you want to figure out what parts are loading slowly, feel free to inspect the network traffic on the NodeBB install.

All suggestions are welcome and appreciated!

Here's my Nginx server:

server {
    listen 80;
    server_name forums.hydroxium.com;

    location / {
            proxy_http_version 1.1;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection 'upgrade';
            proxy_set_header Host $host;
            proxy_redirect off;
            proxy_pass http://127.0.0.1:4567;
    }

And here's my Nginx config:

user www-data;
worker_processes 4;
worker_rlimit_nofile 20480;
pid /run/nginx.pid;

events {
    worker_connections 5120;
    multi_accept on;
    use epoll;
}

http {

    ##
    # Basic Settings
    ##

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;
    charset utf-8;
    client_body_timeout 65;
    client_header_timeout 65;
    client_max_body_size 10m;

    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    ##
    # Logging Settings
    ##

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    ##
    # Gzip Settings
    ##

    gzip on;
    gzip_disable "msie6";

    gzip_vary on;
    gzip_proxied any;
    gzip_comp_level 6;
    gzip_buffers 16 8k;
    gzip_http_version 1.1;
    gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
}

Solution

  • Turns out the VPS it was running on was the problem, it simply didn't have enough power to run everything at the same time without being slow.