Skip to content

Commit 870cd4b

Browse files
committed
Rework nginx.conf to be inline with alpine upstream and relocate lines from other files
1 parent 6aa2e01 commit 870cd4b

File tree

6 files changed

+73
-43
lines changed

6 files changed

+73
-43
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64
330330

331331
## Versions
332332

333+
* **27.04.21:** - [Existing users should update:](https://github.com/linuxserver/docker-swag/blob/master/README.md#updating-configs) nginx.conf, ssl.conf, proxy.conf, and the default site-conf - Rework nginx.conf to be inline with alpine upstream and relocate lines from other files.
333334
* **21.04.21:** - [Existing users should update:](https://github.com/linuxserver/docker-swag/blob/master/README.md#updating-configs) authelia-server.conf and authelia-location.conf - Add remote name/email headers and pass http method.
334335
* **12.04.21:** - Add php7-gmp and php7-pecl-mailparse.
335336
* **12.04.21:** - Add support for vultr dns validation.

readme-vars.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ app_setup_nginx_reverse_proxy_block: ""
151151

152152
# changelog
153153
changelogs:
154+
- { date: "27.04.21:", desc: "[Existing users should update:](https://github.com/linuxserver/docker-swag/blob/master/README.md#updating-configs) nginx.conf, ssl.conf, proxy.conf, and the default site-conf - Rework nginx.conf to be inline with alpine upstream and relocate lines from other files." }
154155
- { date: "21.04.21:", desc: "[Existing users should update:](https://github.com/linuxserver/docker-swag/blob/master/README.md#updating-configs) authelia-server.conf and authelia-location.conf - Add remote name/email headers and pass http method." }
155156
- { date: "12.04.21:", desc: "Add php7-gmp and php7-pecl-mailparse." }
156157
- { date: "12.04.21:", desc: "Add support for vultr dns validation." }

root/defaults/default

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Version 2021/01/03 - Changelog: https://github.com/linuxserver/docker-swag/commits/master/root/defaults/default
1+
## Version 2021/04/27 - Changelog: https://github.com/linuxserver/docker-swag/commits/master/root/defaults/default
22

33
error_page 502 /502.html;
44

@@ -151,5 +151,3 @@ server {
151151

152152
# enable subdomain method reverse proxy confs
153153
include /config/nginx/proxy-confs/*.subdomain.conf;
154-
# enable proxy cache for auth
155-
proxy_cache_path cache/ keys_zone=auth_cache:10m;

root/defaults/nginx.conf

Lines changed: 67 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,97 @@
1-
## Version 2021/02/09 - Changelog: https://github.com/linuxserver/docker-swag/commits/master/root/defaults/nginx.conf
1+
## Version 2021/04/27 - Changelog: https://github.com/linuxserver/docker-swag/commits/master/root/defaults/nginx.conf
22

33
user abc;
4-
worker_processes 4;
5-
pid /run/nginx.pid;
4+
5+
# Set number of worker processes automatically based on number of CPU cores.
6+
worker_processes auto;
7+
8+
# Enables the use of JIT for regular expressions to speed-up their processing.
9+
pcre_jit on;
10+
11+
# Configures default error logger.
12+
error_log /config/log/nginx/error.log warn;
13+
14+
# Includes files with directives to load dynamic modules.
615
include /etc/nginx/modules/*.conf;
716

817
events {
9-
worker_connections 768;
18+
# The maximum number of simultaneous connections that can be opened by
19+
# a worker process.
20+
worker_connections 1024;
1021
# multi_accept on;
1122
}
1223

1324
http {
25+
# Includes mapping of file name extensions to MIME types of responses
26+
# and defines the default type.
27+
include /etc/nginx/mime.types;
28+
default_type application/octet-stream;
29+
30+
# Name servers used to resolve names of upstream servers into addresses.
31+
# It's also needed when using tcpsocket and udpsocket in Lua modules.
32+
resolver 127.0.0.11 valid=30s; # Docker DNS Server
33+
34+
# Don't tell nginx version to the clients. Default is 'on'.
35+
server_tokens off;
36+
37+
# Specifies the maximum accepted body size of a client request, as
38+
# indicated by the request header Content-Length. If the stated content
39+
# length is greater than this size, then the client receives the HTTP
40+
# error code 413. Set to 0 to disable. Default is '1m'.
41+
client_max_body_size 0;
42+
43+
# Sendfile copies data between one FD and other from within the kernel,
44+
# which is more efficient than read() + write(). Default is off.
45+
sendfile on;
46+
47+
# Causes nginx to attempt to send its HTTP response head in one packet,
48+
# instead of using partial frames. Default is 'off'.
49+
tcp_nopush on;
50+
51+
# Helper variable for proxying websockets.
52+
map $http_upgrade $connection_upgrade {
53+
default upgrade;
54+
'' close;
55+
}
56+
57+
# Specifies the main log format.
58+
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
59+
'$status $body_bytes_sent "$http_referer" '
60+
'"$http_user_agent" "$http_x_forwarded_for"';
61+
62+
# Sets the path, format, and configuration for a buffered log write.
63+
access_log /config/log/nginx/access.log main;
64+
65+
# Includes virtual hosts configs.
66+
include /etc/nginx/http.d/*.conf;
67+
include /config/nginx/site-confs/*;
68+
#Removed lua. Do not remove this comment
69+
70+
# WARNING: Don't use this directory for virtual hosts anymore.
71+
# This include will be moved to the root context in Alpine 3.14.
72+
#include /etc/nginx/conf.d/*.conf;
73+
1474

1575
##
1676
# Basic Settings
1777
##
1878

1979
client_body_buffer_size 128k;
20-
client_max_body_size 0;
2180
keepalive_timeout 65;
2281
large_client_header_buffers 4 16k;
2382
send_timeout 5m;
24-
sendfile on;
2583
tcp_nodelay on;
26-
tcp_nopush on;
2784
types_hash_max_size 2048;
2885
variables_hash_max_size 2048;
29-
30-
# server_tokens off;
3186
# server_names_hash_bucket_size 64;
3287
# server_name_in_redirect off;
3388

34-
include /etc/nginx/mime.types;
35-
default_type application/octet-stream;
36-
37-
##
38-
# Logging Settings
39-
##
40-
41-
access_log /config/log/nginx/access.log;
42-
error_log /config/log/nginx/error.log;
43-
4489
##
4590
# Gzip Settings
4691
##
4792

4893
gzip on;
4994
gzip_disable "msie6";
50-
5195
# gzip_vary on;
5296
# gzip_proxied any;
5397
# gzip_comp_level 6;
@@ -72,21 +116,6 @@ http {
72116
#passenger_root /usr;
73117
#passenger_ruby /usr/bin/ruby;
74118

75-
##
76-
# WebSocket proxying
77-
##
78-
map $http_upgrade $connection_upgrade {
79-
default upgrade;
80-
'' close;
81-
}
82-
83-
##
84-
# Virtual Host Configs
85-
##
86-
include /etc/nginx/conf.d/*.conf;
87-
include /config/nginx/site-confs/*;
88-
#Removed lua. Do not remove this comment
89-
90119
##
91120
# Geoip2 config
92121
##
@@ -96,6 +125,8 @@ http {
96125
#include /config/nginx/geoip2.conf;
97126
}
98127

128+
# TIP: Uncomment if you use stream module.
129+
#include /etc/nginx/stream.conf;
99130

100131
#mail {
101132
# # See sample authentication script at:
@@ -118,3 +149,4 @@ http {
118149
# }
119150
#}
120151
daemon off;
152+
pid /run/nginx.pid;

root/defaults/proxy.conf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Version 2020/10/04 - Changelog: https://github.com/linuxserver/docker-swag/commits/master/root/defaults/proxy.conf
1+
## Version 2021/04/27 - Changelog: https://github.com/linuxserver/docker-swag/commits/master/root/defaults/proxy.conf
22

33
# Timeout if the real server is dead
44
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;
@@ -15,6 +15,7 @@ proxy_send_timeout 240;
1515

1616
# Proxy Cache and Cookie Settings
1717
proxy_cache_bypass $cookie_session;
18+
proxy_cache_path cache/ keys_zone=auth_cache:10m;
1819
#proxy_cookie_path / "/; Secure"; # enable at your own risk, may break certain apps
1920
proxy_no_cache $cookie_session;
2021

root/defaults/ssl.conf

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Version 2020/10/29 - Changelog: https://github.com/linuxserver/docker-swag/commits/master/root/defaults/ssl.conf
1+
## Version 2021/04/27 - Changelog: https://github.com/linuxserver/docker-swag/commits/master/root/defaults/ssl.conf
22

33
### Mozilla Recommendations
44
# generated 2020-06-17, Mozilla Guideline v5.4, nginx 1.18.0-r0, OpenSSL 1.1.1g-r0, intermediate configuration
@@ -29,9 +29,6 @@ ssl_trusted_certificate /config/keys/letsencrypt/fullchain.pem;
2929
# Diffie-Hellman Parameters
3030
ssl_dhparam /config/nginx/dhparams.pem;
3131

32-
# Resolver
33-
resolver 127.0.0.11 valid=30s; # Docker DNS Server
34-
3532
# Enable TLS 1.3 early data
3633
ssl_early_data on;
3734

0 commit comments

Comments
 (0)