Changing limit_req of nginx


(Cornelius Kölbel) #1

Hi,
I am running discourse v2.1.0.beta4 +6 with the docker installation on an Ubuntu 16.04 with 2CPUs and 4GB of RAM.
This is no heavy load forum, the average load is 0.11 0.06 0.01.

But sometimes when I visit the site, the html page is not correctly formatted. It looks like CSS files are missing.

I took a look inside the container and I am wondering, if it is nginx, that stops issuing files - I get messages like this in the error log:

2018/05/11 23:04:12 [error] 310#310: *4831 limiting requests, excess: 12.044 by zone "flood", \
       client: ....., server: _, request: "GET /t/name-of-issue/647 HTTP/1.1", host: "....."

It seems like it is due to the limit_req settings in /etc/nginx/conf.d/discourse.conf. Can I change these settings without them being overwritten after an update? Or what would be the requested way to deal with that problem?


(Frederik) #2

A little off topic - how do you see your boards loading times?


(Cornelius Kölbel) #3

This is not actually the loading time but the system load of the underlying Linux system.


(Jeff Atwood) #4

This usually means you are passing the IP through the stack incorrectly so your site (and thus Discourse) sees all requests as coming from the same IP address.


(Cornelius Kölbel) #5

Hi Jeff, thanks a lot for the pointer. But this does not seem to be the case. The nginx/access.log has a lot of different client IPs in it.
What is the recommended way to change nginx/conf.d/discourse.conf to be update resistent?


(Matt Palmer) #6

By persisting the modifications in the app.yml, so the changes get applied on each rebuild of the container.


(Cornelius Kölbel) #7

Thanks a lot, but this does not seem to solve my problem.

Again the stylesheets are missing. The page looks like this:

Looking at the network of the browsers developer mode everything looks fine. There are no failed requests.
Only two CSS are loaded:

https://community.privacyidea.org/stylesheets/admin_ca1a1bc842ff312ef0262dfa29af3e1f7abacd53.css?__ws=community.privacyidea.org
https://community.privacyidea.org/mini-profiler-resources/includes.css?v=251162ee7dc30da30d5370581c664510

This time I look into the nginx error log and it is empty.
The access log only has HTTP 200 OK.

After restarting the container everything is fine - for a while.