Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: nginx optimisations #3423

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 20 additions & 8 deletions ansible/www-standalone/resources/config/nodejs.org
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,17 @@ server {
# These directives prevent our server from continuously attempting to open the same requested files on disk
# Open file descriptors and basic metadata for each file requested gets cached
# For specific location blocks, such as /dist, we also cache file not found (404) and other disk errors
open_file_cache max=100000 inactive=300s;
open_file_cache max=500000 inactive=300s;
open_file_cache_valid 120s;
open_file_cache_min_uses 2;
open_file_cache_errors off;
open_file_cache_min_uses 1;
open_file_cache_errors on;

# This limits the number of connections to the server by creating a maximum amount of concurrent connections
# We limit the number of concurrent connections to be 1000
ovflowd marked this conversation as resolved.
Show resolved Hide resolved
# This can be fine-tuned; @see https://docs.nginx.com/nginx/admin-guide/security-controls/controlling-access-proxied-http/
ovflowd marked this conversation as resolved.
Show resolved Hide resolved
limit_conn_zone $server_name zone=limitconnserver:10m;
limit_conn_status 429;
limit_conn limitconnserver 1000;

root /home/www/nodejs;
default_type text/plain;
Expand Down Expand Up @@ -96,10 +103,17 @@ server {
# These directives prevent our server from continuously attempting to open the same requested files on disk
# Open file descriptors and basic metadata for each file requested gets cached
# For specific location blocks, such as /dist, we also cache file not found (404) and other disk errors
open_file_cache max=100000 inactive=300s;
open_file_cache max=500000 inactive=300s;
open_file_cache_valid 120s;
open_file_cache_min_uses 2;
open_file_cache_errors off;
open_file_cache_min_uses 1;
open_file_cache_errors on;

# This limits the number of connections to the server by creating a maximum amount of concurrent connections
# We limit the number of concurrent connections to be 1000
# This can be fine-tuned; @see https://docs.nginx.com/nginx/admin-guide/security-controls/controlling-access-proxied-http/
limit_conn_zone $server_name zone=limitconnserver:10m;
limit_conn_status 429;
limit_conn limitconnserver 1000;

# We set a default language to "en". This is used for the Localized 404 pages
set $lang en;
Expand Down Expand Up @@ -293,8 +307,6 @@ server {

# This Location directive is used to expose our Website GitHub WebHook Logs
location = /github-webhook.log {
add_header Cache-Control "private, no-store, max-age=0" always;

alias /home/nodejs/github-webhook.log;
ovflowd marked this conversation as resolved.
Show resolved Hide resolved
default_type text/plain;
access_log off;
Expand Down