1
+ ## Version 2024/05/27 - Changelog: https://github.com/linuxserver/docker-baseimage-alpine-nginx/commits/master/root/defaults/nginx/nginx.conf.sample
2
+
3
+ ### Based on alpine defaults
4
+ # https://git.alpinelinux.org/aports/tree/main/nginx/nginx.conf?h=3.20-stable
5
+
6
+ user abc ;
7
+
8
+ # Set number of worker processes automatically based on number of CPU cores.
9
+ include /config/nginx/worker_processes.conf;
10
+
11
+ # Enables the use of JIT for regular expressions to speed-up their processing.
12
+ pcre_jit on;
13
+
14
+ # Configures default error logger.
15
+ error_log /config/log/nginx/error.log;
16
+
17
+ # Includes files with directives to load dynamic modules.
18
+ include /etc/nginx/modules/*.conf;
19
+
20
+ # Include files with config snippets into the root context.
21
+ include /etc/nginx/conf.d/*.conf;
22
+
23
+ events {
24
+ # The maximum number of simultaneous connections that can be opened by
25
+ # a worker process.
26
+ worker_connections 1024 ;
27
+ }
28
+
29
+ http {
30
+ # Includes mapping of file name extensions to MIME types of responses
31
+ # and defines the default type.
32
+ include /etc/nginx/mime.types;
33
+ default_type application/octet-stream;
34
+
35
+ # Name servers used to resolve names of upstream servers into addresses.
36
+ # It's also needed when using tcpsocket and udpsocket in Lua modules.
37
+ #resolver 1.1.1.1 1.0.0.1 2606:4700:4700::1111 2606:4700:4700::1001;
38
+ include /config/nginx/resolver.conf;
39
+
40
+ # Don't tell nginx version to the clients. Default is 'on'.
41
+ server_tokens off ;
42
+
43
+ # Specifies the maximum accepted body size of a client request, as
44
+ # indicated by the request header Content-Length. If the stated content
45
+ # length is greater than this size, then the client receives the HTTP
46
+ # error code 413. Set to 0 to disable. Default is '1m'.
47
+ client_max_body_size 0 ;
48
+
49
+ # Sendfile copies data between one FD and other from within the kernel,
50
+ # which is more efficient than read() + write(). Default is off.
51
+ sendfile on ;
52
+
53
+ # Causes nginx to attempt to send its HTTP response head in one packet,
54
+ # instead of using partial frames. Default is 'off'.
55
+ tcp_nopush on ;
56
+
57
+ # all ssl related config moved to ssl.conf
58
+ # included in server blocks where listen 443 is defined
59
+
60
+ # Enable gzipping of responses.
61
+ #gzip on;
62
+
63
+ # Set the Vary HTTP header as defined in the RFC 2616. Default is 'off'.
64
+ gzip_vary on ;
65
+
66
+ # Helper variable for proxying websockets.
67
+ map $http_upgrade $connection_upgrade {
68
+ default upgrade;
69
+ '' close;
70
+ }
71
+
72
+ # Sets the path, format, and configuration for a buffered log write.
73
+ access_log /config/log/nginx/access.log;
74
+
75
+ # Includes virtual hosts configs.
76
+ include /etc/nginx/http.d/*.conf;
77
+
78
+ #include /config/nginx/site-confs/*.conf;
79
+ server {
80
+ listen 80 default_server ;
81
+ listen [::]:80 default_server ;
82
+
83
+ listen 443 ssl http2 default_server ;
84
+ listen [::]:443 ssl http2 default_server ;
85
+
86
+ server_name _;
87
+
88
+ include /config/nginx/ssl.conf;
89
+
90
+ set $root /app/www/public;
91
+ if (!-d /app/www/public) {
92
+ set $root /config/www;
93
+ }
94
+ root $root ;
95
+ index index.html index.htm index.php;
96
+
97
+ location / {
98
+ # enable for basic auth
99
+ #auth_basic "Restricted";
100
+ #auth_basic_user_file /config/nginx/.htpasswd;
101
+
102
+ try_files $uri $uri / /index.html /index.php$is_args$args ;
103
+ }
104
+
105
+ location ~ ^(.+\.php)(.*)$ {
106
+ try_files $fastcgi_script_name =404 ;
107
+ fastcgi_split_path_info ^(.+\.php)(.*)$ ;
108
+ fastcgi_pass 127.0.0.1:9000;
109
+ fastcgi_index index.php;
110
+ include /etc/nginx/fastcgi_params;
111
+ }
112
+
113
+ location ~ ^/api/(.*)$ {
114
+ try_files $uri /api/index.php?endpoint=$1$is_args$args ;
115
+ }
116
+
117
+ # deny access to .htaccess/.htpasswd files
118
+ location ~ /\.ht {
119
+ deny all ;
120
+ }
121
+ }
122
+ }
123
+
124
+ daemon off ;
125
+ pid /run/nginx.pid;
0 commit comments