Skip to content

Commit 4cfc1e9

Browse files
authored
Merge pull request #18 from skilld-labs/add-16
Add 1.16 version
2 parents e3c82bc + 477e6a4 commit 4cfc1e9

File tree

5 files changed

+355
-0
lines changed

5 files changed

+355
-0
lines changed

16/Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM alpine:3.10
2+
3+
RUN set -ex &&\
4+
apk add --no-cache --upgrade nginx nginx-mod-http-upload-progress
5+
6+
COPY fastcgi_params nginx.conf upstream /etc/nginx/
7+
COPY default.conf /etc/nginx/conf.d/
8+
9+
WORKDIR /var/www/html
10+
VOLUME /var/www/html
11+
12+
EXPOSE 80 443
13+
14+
CMD ["nginx", "-g", "daemon off;"]

16/default.conf

Lines changed: 250 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,250 @@
1+
include upstream;
2+
3+
server {
4+
server_name SERVER_NAME;
5+
listen 80;
6+
7+
root /var/www/html/web;
8+
index index.php;
9+
10+
fastcgi_keep_conn on;
11+
fastcgi_index index.php;
12+
fastcgi_param QUERY_STRING $query_string;
13+
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
14+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
15+
16+
location / {
17+
18+
proxy_http_version 1.1;
19+
proxy_set_header Upgrade $http_upgrade;
20+
proxy_set_header Connection 'upgrade';
21+
proxy_set_header Host $host;
22+
proxy_set_header X-Real-IP $remote_addr;
23+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
24+
proxy_set_header X-Forwarded-Proto $scheme;
25+
proxy_cache_bypass $http_upgrade;
26+
27+
location ~* /system/files/ {
28+
include fastcgi_params;
29+
fastcgi_param QUERY_STRING q=$uri&$args;
30+
fastcgi_param SCRIPT_NAME /index.php;
31+
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
32+
fastcgi_hide_header 'X-Drupal-Cache';
33+
fastcgi_hide_header 'X-Generator';
34+
fastcgi_pass upstream;
35+
log_not_found off;
36+
}
37+
38+
location ~* /sites/.*/files/private/ {
39+
internal;
40+
}
41+
42+
location ~* /files/styles/ {
43+
access_log off;
44+
expires 30d;
45+
try_files $uri @drupal;
46+
}
47+
48+
location ~* /sites/.+/files/.+\.txt {
49+
access_log off;
50+
expires 7d;
51+
tcp_nodelay off;
52+
open_file_cache max=1000 inactive=30s;
53+
open_file_cache_valid 30s;
54+
open_file_cache_min_uses 2;
55+
open_file_cache_errors off;
56+
}
57+
58+
location ~* /sites/.*/files/advagg_css/ {
59+
expires max;
60+
add_header ETag '';
61+
add_header Last-Modified 'Wed, 20 Jan 1988 04:20:42 GMT';
62+
add_header Accept-Ranges '';
63+
location ~* /sites/.*/files/advagg_css/css[_[:alnum:]]+\.css$ {
64+
access_log off;
65+
try_files $uri @drupal;
66+
}
67+
}
68+
69+
location ~* /sites/.*/files/advagg_js/ {
70+
expires max;
71+
add_header ETag '';
72+
add_header Last-Modified 'Wed, 20 Jan 1988 04:20:42 GMT';
73+
add_header Accept-Ranges '';
74+
location ~* /sites/.*/files/advagg_js/js[_[:alnum:]]+\.js$ {
75+
access_log off;
76+
try_files $uri @drupal;
77+
}
78+
}
79+
80+
location ~* /admin/reports/hacked/.+/diff/ {
81+
try_files $uri @drupal;
82+
}
83+
84+
location ~* ^.+\.(?:cur|jpe?g|gif|htc|ico|png|xml|otf|ttf|eot|woff|woff2|svg)$ {
85+
access_log off;
86+
expires 30d;
87+
tcp_nodelay off;
88+
open_file_cache max=3000 inactive=120s;
89+
open_file_cache_valid 45s;
90+
open_file_cache_min_uses 2;
91+
open_file_cache_errors off;
92+
}
93+
94+
location ~* ^.+\.(?:css|js)$ {
95+
access_log off;
96+
expires 30d;
97+
tcp_nodelay off;
98+
open_file_cache off;
99+
}
100+
101+
location ~* ^.+\.(?:pdf|pptx?)$ {
102+
expires 30d;
103+
tcp_nodelay off;
104+
}
105+
106+
location ~* ^(?:.+\.(?:htaccess|make|txt|engine|inc|info|install|module|profile|po|pot|sh|.*sql|theme|tpl(?:\.php)?|xtmpl)|code-style\.pl|/Entries.*|/Repository|/Root|/Tag|/Template)$ {
107+
return 404;
108+
}
109+
try_files $uri @drupal;
110+
}
111+
112+
location @drupal {
113+
include fastcgi_params;
114+
fastcgi_param QUERY_STRING $query_string;
115+
fastcgi_param SCRIPT_NAME /index.php;
116+
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
117+
fastcgi_hide_header 'X-Drupal-Cache';
118+
fastcgi_hide_header 'X-Generator';
119+
fastcgi_pass upstream;
120+
track_uploads uploads 60s;
121+
}
122+
123+
location @drupal-no-args {
124+
include fastcgi_params;
125+
fastcgi_param QUERY_STRING q=$uri;
126+
fastcgi_param SCRIPT_NAME /index.php;
127+
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
128+
fastcgi_hide_header 'X-Drupal-Cache';
129+
fastcgi_hide_header 'X-Generator';
130+
fastcgi_pass upstream;
131+
}
132+
133+
location = /index.php {
134+
include fastcgi_params;
135+
fastcgi_param QUERY_STRING $query_string;
136+
fastcgi_param SCRIPT_NAME /index.php;
137+
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
138+
fastcgi_hide_header 'X-Drupal-Cache';
139+
fastcgi_hide_header 'X-Generator';
140+
fastcgi_pass upstream;
141+
}
142+
143+
location = /cron {
144+
include fastcgi_params;
145+
fastcgi_param QUERY_STRING q=$uri&$args;
146+
fastcgi_param SCRIPT_NAME /index.php;
147+
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
148+
fastcgi_hide_header 'X-Drupal-Cache';
149+
fastcgi_hide_header 'X-Generator';
150+
fastcgi_pass upstream;
151+
}
152+
153+
location ~* ^/update.php {
154+
include fastcgi_params;
155+
fastcgi_param QUERY_STRING $args;
156+
fastcgi_param SCRIPT_NAME /update.php;
157+
fastcgi_param SCRIPT_FILENAME $document_root/update.php;
158+
fastcgi_hide_header 'X-Drupal-Cache';
159+
fastcgi_hide_header 'X-Generator';
160+
fastcgi_pass upstream;
161+
}
162+
163+
location = /core/install.php {
164+
include fastcgi_params;
165+
fastcgi_param QUERY_STRING $args;
166+
fastcgi_param SCRIPT_NAME /core/install.php;
167+
fastcgi_param SCRIPT_FILENAME $document_root/core/install.php;
168+
fastcgi_hide_header 'X-Drupal-Cache';
169+
fastcgi_hide_header 'X-Generator';
170+
fastcgi_pass upstream;
171+
}
172+
173+
location ~* ^/core/authorize.php {
174+
include fastcgi_params;
175+
fastcgi_param QUERY_STRING $args;
176+
fastcgi_param SCRIPT_NAME /core/authorize.php;
177+
fastcgi_param SCRIPT_FILENAME $document_root/core/authorize.php;
178+
fastcgi_hide_header 'X-Drupal-Cache';
179+
fastcgi_hide_header 'X-Generator';
180+
fastcgi_pass upstream;
181+
}
182+
183+
location ^~ /.bzr {
184+
return 404;
185+
}
186+
187+
location ^~ /.git {
188+
return 404;
189+
}
190+
191+
location ^~ /.hg {
192+
return 404;
193+
}
194+
195+
location ^~ /.svn {
196+
return 404;
197+
}
198+
199+
location ^~ /.cvs {
200+
return 404;
201+
}
202+
203+
location ^~ /patches {
204+
return 404;
205+
}
206+
207+
location ^~ /backup {
208+
return 404;
209+
}
210+
211+
location = /robots.txt {
212+
access_log off;
213+
try_files $uri @drupal-no-args;
214+
}
215+
216+
location = /rss.xml {
217+
try_files $uri @drupal-no-args;
218+
}
219+
220+
location = /sitemap.xml {
221+
try_files $uri @drupal-no-args;
222+
}
223+
224+
location = /favicon.ico {
225+
expires 30d;
226+
try_files /favicon.ico @empty;
227+
}
228+
229+
location ~* ^/.well-known/ {
230+
allow all;
231+
}
232+
233+
location @empty {
234+
expires 30d;
235+
empty_gif;
236+
}
237+
238+
location ~* ^.+\.php$ {
239+
return 404;
240+
}
241+
242+
location ~ (?<upload_form_uri>.*)/x-progress-id:(?<upload_id>\d*) {
243+
rewrite ^ $upload_form_uri?X-Progress-ID=$upload_id;
244+
}
245+
246+
location ~ ^/progress$ {
247+
upload_progress_json_output;
248+
report_uploads uploads;
249+
}
250+
}

16/fastcgi_params

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
fastcgi_param REQUEST_METHOD $request_method;
2+
fastcgi_param CONTENT_TYPE $content_type;
3+
fastcgi_param CONTENT_LENGTH $content_length;
4+
5+
fastcgi_param REQUEST_URI $request_uri;
6+
fastcgi_param DOCUMENT_URI $document_uri;
7+
fastcgi_param DOCUMENT_ROOT $document_root;
8+
fastcgi_param SERVER_PROTOCOL $server_protocol;
9+
10+
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
11+
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
12+
fastcgi_param REMOTE_ADDR $remote_addr;
13+
fastcgi_param REMOTE_PORT $remote_port;
14+
fastcgi_param SERVER_ADDR $server_addr;
15+
fastcgi_param SERVER_PORT $server_port;
16+
fastcgi_param SERVER_NAME $server_name;
17+
18+
fastcgi_param REDIRECT_STATUS 200;
19+
20+
fastcgi_param HTTPS $fastcgi_https if_not_empty;
21+
22+
fastcgi_param HTTP_MOD_REWRITE On;
23+
24+
## Fix HTTPoxy vulnerability https://httpoxy.org/#mitigate-nginx.
25+
fastcgi_param HTTP_PROXY '';

16/nginx.conf

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
user nginx;
2+
worker_processes 1;
3+
error_log /proc/self/fd/2;
4+
pid /var/run/nginx.pid;
5+
6+
pcre_jit on;
7+
8+
include /etc/nginx/modules/*.conf;
9+
10+
events {
11+
worker_connections 1024;
12+
multi_accept on;
13+
}
14+
15+
http {
16+
include /etc/nginx/mime.types;
17+
default_type application/octet-stream;
18+
fastcgi_buffers 256 4k;
19+
fastcgi_buffer_size 32k;
20+
fastcgi_intercept_errors on;
21+
fastcgi_read_timeout 900;
22+
include fastcgi_params;
23+
access_log /proc/self/fd/2;
24+
port_in_redirect off;
25+
send_timeout 600;
26+
sendfile on;
27+
client_body_timeout 600;
28+
client_header_timeout 600;
29+
client_max_body_size 256M;
30+
keepalive_timeout 60;
31+
keepalive_requests 100;
32+
reset_timedout_connection off;
33+
tcp_nodelay on;
34+
tcp_nopush on;
35+
server_tokens off;
36+
upload_progress uploads 1m;
37+
38+
gzip on;
39+
gzip_buffers 16 8k;
40+
gzip_comp_level 2;
41+
gzip_http_version 1.1;
42+
gzip_min_length 10240;
43+
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript image/x-icon application/vnd.ms-fontobject font/opentype application/x-font-ttf;
44+
gzip_vary on;
45+
gzip_proxied any;
46+
gzip_disable msie6;
47+
48+
add_header X-XSS-Protection '1; mode=block';
49+
add_header X-Frame-Options SAMEORIGIN;
50+
add_header X-Content-Type-Options nosniff;
51+
52+
map $http_x_forwarded_proto $fastcgi_https {
53+
default $https;
54+
http '';
55+
https on;
56+
}
57+
58+
map $uri $no_slash_uri {
59+
~^/(?<no_slash>.*)$ $no_slash;
60+
}
61+
62+
include /etc/nginx/conf.d/*.conf;
63+
}

16/upstream

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
upstream upstream {
2+
server php:9000;
3+
}

0 commit comments

Comments
 (0)