Skip to content

NODEBB: Nginx error performance & High CPU

Solved Performance
69 3 62.9k 2
  • @phenomlab

    Ok I will see it for better worker_processes value

    I add a rate limite request and limit_conn_zone on http block and vhost block :

    – nginx.conf:

    http {
    
    	#Requete maximun par ip 
    	limit_req_zone $binary_remote_addr zone=flood:10m rate=100r/s; 
    	#Connexions maximum par ip 
    	limit_conn_zone $binary_remote_addr zone=ddos:1m;
    
    -- vhost.conf :
            location / {
    				
    				limit_req zone=flood burst=100 nodelay; 
    				limit_conn ddos 10;
    

    –> I have test other value for rate and burst but they cause problem access to the forum. If you have better, I take it

    I add today a proxy_read_timeout on vhost.conf (60 by default)

    proxy_read_timeout 180;
    

    I have deactivate underattack mode on CF and change for high Level

    I have add other rules on CF waf :

    9059db6c-f4f3-4415-bb47-ab88b2b41861-image.png

    wrote on last edited by
    #26

    @DownPW what settings do you have in advanced (in settings) for rate limit etc?

  • @DownPW what settings do you have in advanced (in settings) for rate limit etc?

    wrote on last edited by
    #27

    @phenomlab said in NODEBB: Nginx error performance & High CPU:

    @DownPW what settings do you have in advanced (in settings) for rate limit etc?

    In cloudflare ?

  • wrote on last edited by DownPW
    #28

    @phenomlab

    I wanted to test awstats on virtualmin with root account and it hasn’t updated since August 2022.

    I wanted to regenerate the files but I have a problem of rights.

    df12b039-076d-4e64-9a8d-ad6580ed57dc-image.png
    4030eec2-29ce-4dcf-83f6-adc60f87be5e-image.png

    What do you think ? and how t ore-generate a rapport correctly

    I would like to use it to better manage the @ips that connect to the server

  • @phenomlab said in NODEBB: Nginx error performance & High CPU:

    @DownPW what settings do you have in advanced (in settings) for rate limit etc?

    In cloudflare ?

    wrote on last edited by
    #29

    @DownPW no, sorry - in NodeBB ACP

  • @phenomlab

    I wanted to test awstats on virtualmin with root account and it hasn’t updated since August 2022.

    I wanted to regenerate the files but I have a problem of rights.

    df12b039-076d-4e64-9a8d-ad6580ed57dc-image.png
    4030eec2-29ce-4dcf-83f6-adc60f87be5e-image.png

    What do you think ? and how t ore-generate a rapport correctly

    I would like to use it to better manage the @ips that connect to the server

    wrote on last edited by
    #30

    @DownPW from recollection, awstats is accessible via the web front end, so (for example) https://mydomain.com/awstats

    However, as you are pushing everything into a reverse proxy you’ll need to add a custom route in the nginx.conf file you are using on the website so this can be rendered outside of NodeBB.

  • @DownPW no, sorry - in NodeBB ACP

    wrote on last edited by
    #31

    @phenomlab said in NODEBB: Nginx error performance & High CPU:

    @DownPW no, sorry - in NodeBB ACP

    Here is the value

    28e6dd12-e727-4a6a-a06f-b7c7dd3ed431-image.png

  • @phenomlab said in NODEBB: Nginx error performance & High CPU:

    @DownPW no, sorry - in NodeBB ACP

    Here is the value

    28e6dd12-e727-4a6a-a06f-b7c7dd3ed431-image.png

    wrote on last edited by
    #32

    @DownPW what is the result of disabling it altogether? That will resolve the 503 rate limit error but could we leave the system exposed to bring overwhelmed.

  • @DownPW what is the result of disabling it altogether? That will resolve the 503 rate limit error but could we leave the system exposed to bring overwhelmed.

    wrote on last edited by
    #33

    @DownPW you should also review this

    https://docs.nodebb.org/configuring/scaling/

    In particular, the part concerning proxied assets.

  • @DownPW from recollection, awstats is accessible via the web front end, so (for example) https://mydomain.com/awstats

    However, as you are pushing everything into a reverse proxy you’ll need to add a custom route in the nginx.conf file you are using on the website so this can be rendered outside of NodeBB.

    wrote on last edited by
    #34

    @phenomlab said in NODEBB: Nginx error performance & High CPU:

    @DownPW from recollection, awstats is accessible via the web front end, so (for example) https://mydomain.com/awstats

    However, as you are pushing everything into a reverse proxy you’ll need to add a custom route in the nginx.conf file you are using on the website so this can be rendered outside of NodeBB.

    Thats why I have a permission error like the screen? Odd

    Nope, Awstats is accessible like this via Virtualmin:

    https://XXXX:8443/virtualmin-awstats/view.cgi?config=XXXXXX.XX

    a3404ab3-4f2b-4623-9858-534ac8507bce-image.png
    7597a4ac-22e5-4cd6-884c-e149dcb6edbe-image.png
    f8285325-3072-4668-869b-e5e6152c5641-image.png

    I have jsut an error of permission whe nI test to regenerate a Report because the script can’t access to log file

  • @DownPW what is the result of disabling it altogether? That will resolve the 503 rate limit error but could we leave the system exposed to bring overwhelmed.

    wrote on last edited by
    #35

    @phenomlab said in NODEBB: Nginx error performance & High CPU:

    @DownPW what is the result of disabling it altogether? That will resolve the 503 rate limit error but could we leave the system exposed to bring overwhelmed.

    Disabling What ? Traffic management? HSTS ?

  • @phenomlab said in NODEBB: Nginx error performance & High CPU:

    @DownPW from recollection, awstats is accessible via the web front end, so (for example) https://mydomain.com/awstats

    However, as you are pushing everything into a reverse proxy you’ll need to add a custom route in the nginx.conf file you are using on the website so this can be rendered outside of NodeBB.

    Thats why I have a permission error like the screen? Odd

    Nope, Awstats is accessible like this via Virtualmin:

    https://XXXX:8443/virtualmin-awstats/view.cgi?config=XXXXXX.XX

    a3404ab3-4f2b-4623-9858-534ac8507bce-image.png
    7597a4ac-22e5-4cd6-884c-e149dcb6edbe-image.png
    f8285325-3072-4668-869b-e5e6152c5641-image.png

    I have jsut an error of permission whe nI test to regenerate a Report because the script can’t access to log file

    wrote on last edited by
    #36

    @DownPW said in NODEBB: Nginx error performance & High CPU:

    Thats why I have a permission error like the screen? Odd

    No, not at all. That error is because www-data owns the files when it should be the account you are using to run the website itself under.

  • @DownPW said in NODEBB: Nginx error performance & High CPU:

    Thats why I have a permission error like the screen? Odd

    No, not at all. That error is because www-data owns the files when it should be the account you are using to run the website itself under.

    wrote on last edited by
    #37

    @phenomlab said in NODEBB: Nginx error performance & High CPU:

    @DownPW said in NODEBB: Nginx error performance & High CPU:

    Thats why I have a permission error like the screen? Odd

    No, not at all. That error is because www-data owns the files when it should be the account you are using to run the website itself under.

    I thought that was weird 😉

    strange than that.

    –> Would you have a solution so that I can regenerate the report and use awstats via virtualmin?

  • @phenomlab said in NODEBB: Nginx error performance & High CPU:

    @DownPW said in NODEBB: Nginx error performance & High CPU:

    Thats why I have a permission error like the screen? Odd

    No, not at all. That error is because www-data owns the files when it should be the account you are using to run the website itself under.

    I thought that was weird 😉

    strange than that.

    –> Would you have a solution so that I can regenerate the report and use awstats via virtualmin?

    wrote on last edited by
    #38
  • wrote on last edited by DownPW
    #39

    @phenomlab said in NODEBB: Nginx error performance & High CPU:

    @DownPW try this
    https://manpages.org/awstats

    It worked with the following command (very long) in cli but I’m afraid it won’t work with the virtualmin module

    awstats -config=XXX-XXX.XXX -update
    

    9085ad1b-04c0-4172-bdc3-608288fc0800-image.png

  • @phenomlab said in NODEBB: Nginx error performance & High CPU:

    @DownPW try this
    https://manpages.org/awstats

    It worked with the following command (very long) in cli but I’m afraid it won’t work with the virtualmin module

    awstats -config=XXX-XXX.XXX -update
    

    9085ad1b-04c0-4172-bdc3-608288fc0800-image.png

    wrote on last edited by
    #40

    @DownPW yes, that was a command line to get you the immediate information you needed. Did you try adding the necessary config to nginx in order that it bypasses the reverse proxy?

  • Hello

    Since yesterday, we have been experiencing a massive influx of new users.

    Today we have more than 1000 simultaneous connections (account creation, participation in topics, etc.)

    I had a lot of issues with Nginx that I think I got fixed.

    I have several “worker_connections is too long” & “too many openfiles” errors on nginx log :

    48103f1b-f4f0-496b-bb5d-bd870b1807fd-image.png
    f551f1f9-b9e5-4b57-a89f-af14e2675a3f-image.png

    I think I solved his 2 problems in the following way :

    systemctl edit --full nginx.service
    
    	[Service]
    	LimitNOFILE=70000
    
    nano /etc/nginx/nginx.conf
    	worker_rlimit_nofile 70000; 
    
    events {
    	# worker_connections 768;
    	worker_connections 65535;
    	# multi_accept on;
    	multi_accept on; 
    }
    

    I have “client intended to send too large body” errors too :
    bba58f12-0ca4-4fe7-9d49-ad0ef994b37d-image.png

    I think I solved this problem in the following way :

    nano /etc/nginx/nginx.conf
    	http {
    
    	##
    	# Basic Settings
    	##
    
    	client_max_body_size 10M; 
    

    –> I hope this will be enough for Nginx.


    But now, I have a problem of CPU performance (sometimes, not ) which causes nodebb 503 errors (not nginx) or latencies because nodeJS and mongodb takes a lot of CPU.

    1ced94bf-f56c-4d2a-a701-8f39c8d2868d-image.png

    – Would there be tweaks for nodejs, nodebb or mongodb to prevent the influx of users from draining the CPU - RAM ?

    – If you have better values for nginx error (see above the topic) or better fix, tell me 🙂

    Thanks in advance @phenomlab

    wrote on last edited by
    #41

    @DownPW one day a year, we have the same problem in our forum, where several thousand users become online at the same minute and get similar problems… but we are getting better each year at handling this…

    I do not have full technical details about our solution but I know for sure that using NodeBB that listens to three ports help… 4567, 4568, and 4569… Is your NodeBB set up this way?

  • @DownPW one day a year, we have the same problem in our forum, where several thousand users become online at the same minute and get similar problems… but we are getting better each year at handling this…

    I do not have full technical details about our solution but I know for sure that using NodeBB that listens to three ports help… 4567, 4568, and 4569… Is your NodeBB set up this way?

    wrote on last edited by
    #42

    @crazycells said in NODEBB: Nginx error performance & High CPU:

    4567, 4568, and 4569… Is your NodeBB set up this way?

    It’s not (I set their server up). Sudonix is not configured this way either, but from memory, this also requires redis to handle the session data. I may configure this site to do exactly that.

  • @crazycells said in NODEBB: Nginx error performance & High CPU:

    4567, 4568, and 4569… Is your NodeBB set up this way?

    It’s not (I set their server up). Sudonix is not configured this way either, but from memory, this also requires redis to handle the session data. I may configure this site to do exactly that.

    wrote on last edited by
    #43

    @phenomlab said in NODEBB: Nginx error performance & High CPU:

    @crazycells said in NODEBB: Nginx error performance & High CPU:

    4567, 4568, and 4569… Is your NodeBB set up this way?

    It’s not (I set their server up). Sudonix is not configured this way either, but from memory, this also requires redis to handle the session data. I may configure this site to do exactly that.

    yep it’s not but it interests me a lot.
    I see the documentation but I would have to adapt to our configuration and is it really worth doing?
    Where I put ionode directives? on nginx.conf or vhost your_website.conf ? I think on nginx.conf

    And where put proxy_pass directive? on nginx.conf or vhost your_website.Conf ?

    It’s still pretty blurry but I just took a look at it;

    https://docs.nodebb.org/configuring/scaling/

  • @phenomlab said in NODEBB: Nginx error performance & High CPU:

    @crazycells said in NODEBB: Nginx error performance & High CPU:

    4567, 4568, and 4569… Is your NodeBB set up this way?

    It’s not (I set their server up). Sudonix is not configured this way either, but from memory, this also requires redis to handle the session data. I may configure this site to do exactly that.

    yep it’s not but it interests me a lot.
    I see the documentation but I would have to adapt to our configuration and is it really worth doing?
    Where I put ionode directives? on nginx.conf or vhost your_website.conf ? I think on nginx.conf

    And where put proxy_pass directive? on nginx.conf or vhost your_website.Conf ?

    It’s still pretty blurry but I just took a look at it;

    https://docs.nodebb.org/configuring/scaling/

    wrote on last edited by
    #44

    @DownPW It’s more straightforward than it sounds, although can be confusing if you look at it for the first time. I’ve just implemented it here. Can you provide your nginx config and your config.json (remove password obviously)

    Thanks

  • @DownPW yes, that was a command line to get you the immediate information you needed. Did you try adding the necessary config to nginx in order that it bypasses the reverse proxy?

    wrote on last edited by
    #45

    @phenomlab said in NODEBB: Nginx error performance & High CPU:

    @DownPW yes, that was a command line to get you the immediate information you needed. Did you try adding the necessary config to nginx in order that it bypasses the reverse proxy?

    @phenomlab

    Nope because I don’t know what it will be used for.

    I access the report just fine without it.

    I would just like to use webmin to generate it every day automatically.
    I would just like to settle this permissions thing.


Did this solution help you?
Did you find the suggested solution useful? Support 💗 Sudonix with a coffee ☕
If your organisation needs deeper expertise around infrastructure, security, or technology leadership, learn more about Phenomlab Ltd. Many of the deeper technical guides behind Sudonix are published there.

Related Topics
  • 4 Votes
    3 Posts
    2k Views
    crazycells
    thanks @DownPW ! this is definitely very helpful.
  • NodeBB socket with CloudFlare

    Solved Performance socket cloudflare nodebb
    24
    3 Votes
    24 Posts
    14k Views
    DownPW
    Solved. Tuto here and here
  • Bug in Nodebb route when clicking title

    Moved Configure nodebb
    3
    2 Votes
    3 Posts
    1k Views
    Panda
    Ah silly me, thanks for finding that!
  • SEO and Nodebb

    Performance nodebb seo
    2
    2 Votes
    2 Posts
    2k Views
    phenomlab
    @Panda It’s the best it’s ever been to be honest. I’ve used a myriad of systems in the past - most notably, WordPress, and then Flarum (which for SEO, was absolutely dire - they never even had SEO out of the box, and relied on a third party extension to do it), and NodeBB easily fares the best - see below example https://www.google.com/search?q=site%3Asudonix.org&oq=site%3Asudonix.org&aqs=chrome..69i57j69i60j69i58j69i60l2.9039j0j3&sourceid=chrome&ie=UTF-8#ip=1 However, this was not without significant effort on my part once I’d migrated from COM to ORG - see below posts https://community.nodebb.org/topic/17286/google-crawl-error-after-site-migration/17?_=1688461250365 And also https://support.google.com/webmasters/thread/221027803?hl=en&msgid=221464164 It was painful to say the least - as it turns out, there was an issue in NodeBB core that prevented spiders from getting to content, which as far as I understand, is now fixed. SEO in itself is a dark art - a black box that nobody really fully understands, and it’s essentially going to boil down to one thing - “content”. Google’s algorithm for indexing has also changed dramatically over the years. They only now crawl content that has value, so if it believes that your site has nothing to offer, it will simply skip it.
  • Header Menu After Upgrading V3.1.1

    Solved Customisation header nodebb
    2
    1
    2 Votes
    2 Posts
    1k Views
    phenomlab
    @cagatay this relates to a change the css classes used for the brand header meaning it will now float to the left instead of right. If you’d like to retain the original behavior, you can add this css class [data-widget-area="brand-header"] { justify-content: end; display: flex; } Further information here https://community.nodebb.org/topic/17090/manual-build-a-custom-header-in-harmony/19?_=1684069325296
  • build nodebb Warning in entrypoint size limit

    Solved Performance nodebb
    2
    0 Votes
    2 Posts
    1k Views
    phenomlab
    @eeeee they are nothing to worry about, and can be ignored.
  • Forum Icons NodeBB

    Solved Customisation icons forum nodebb
    13
    0 Votes
    13 Posts
    5k Views
    phenomlab
    @cagatay That matches what I see [image: 4f0f858d-9812-42b1-9f61-ffb13d31dccd-image.png]
  • Social icon (Nodebb)

    Solved Customisation nodebb social
    7
    0 Votes
    7 Posts
    3k Views
    JAC
    @phenomlab said in Social icon (Nodebb): @jac I just tested my theory around using the OG image, and according to the Twitter card validator, it works fine [image: 73e805e1-997b-41bf-9259-51c5052ca8fc-image.png] fixed