Skip to content

Commit 850f1b0

Browse files
committed
Create nginx.conf.template
1 parent 8007091 commit 850f1b0

File tree

1 file changed

+118
-0
lines changed

1 file changed

+118
-0
lines changed
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
upstream docker_drupal {
2+
server drupal:9000;
3+
}
4+
5+
upstream docker_varnish {
6+
server varnish:8080;
7+
}
8+
9+
map $scheme $proxy_x_forwarded_ssl {
10+
default off;
11+
https on;
12+
}
13+
14+
server {
15+
listen ${NGINX_PORT} default_server;
16+
listen [::]:${NGINX_PORT} ipv6only=on default_server;
17+
#
18+
server_name ${NGINX_HOST} www.${NGINX_HOST};
19+
#
20+
location ~ ^/.well-known/acme-challenge/ {
21+
root /tmp/acme-challenge;
22+
}
23+
#
24+
#location / {
25+
#port_in_redirect off;
26+
#return 301 https://$host$request_uri;
27+
#}
28+
}
29+
30+
server {
31+
#listen 443 ssl http2;
32+
#listen [::]:443 ipv6only=on ssl http2;
33+
#
34+
server_name ${NGINX_HOST} www.${NGINX_HOST};
35+
#
36+
#ssl_certificate /etc/letsencrypt/live/${NGINX_HOST}/fullchain.pem;
37+
#ssl_certificate_key /etc/letsencrypt/live/${NGINX_HOST}/privkey.pem;
38+
#ssl_trusted_certificate /etc/letsencrypt/live/${NGINX_HOST}/chain.pem;
39+
#ssl_dhparam /etc/letsencrypt/ssl-dhparam.pem;
40+
include /etc/letsencrypt/options-ssl-nginx.conf;
41+
42+
location / {
43+
proxy_pass http://docker_varnish;
44+
proxy_set_header X-Real-IP $remote_addr;
45+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
46+
proxy_set_header X-Forwarded-Proto $scheme;
47+
proxy_set_header Host $host;
48+
proxy_set_header X-Forwarded-Host $host;
49+
proxy_set_header X-Forwarded-Port $server_port;
50+
proxy_set_header Upgrade $http_upgrade;
51+
proxy_set_header Connection "Upgrade";
52+
proxy_set_header X-Forwarded-Ssl $proxy_x_forwarded_ssl;
53+
54+
#
55+
proxy_redirect off;
56+
proxy_buffering on;
57+
proxy_buffer_size 128k;
58+
proxy_buffers 100 8k;
59+
proxy_connect_timeout 90;
60+
proxy_send_timeout 90;
61+
proxy_read_timeout 90;
62+
proxy_request_buffering off;
63+
#
64+
# Mitigate httpoxy attack
65+
proxy_set_header Proxy "";
66+
}
67+
#
68+
# deny access to .htaccess vb. files, if Apache's document root
69+
location ~/\. {
70+
deny all;
71+
log_not_found off;
72+
}
73+
#
74+
location ~ /.well-known {
75+
allow all;
76+
}
77+
#
78+
location = /favicon.ico {
79+
log_not_found off;
80+
access_log off;
81+
}
82+
#
83+
location = /robots.txt {
84+
allow all;
85+
log_not_found off;
86+
access_log off;
87+
}
88+
#
89+
access_log off;
90+
error_log /var/log/nginx/${NGINX_HOST}-443.error.log error;
91+
}
92+
93+
server {
94+
#listen 81;
95+
#listen [::]:81 ipv6only=on;
96+
#
97+
server_name ${NGINX_HOST} www.${NGINX_HOST};
98+
#
99+
100+
root /var/www/html;
101+
index index.php;
102+
103+
location / {
104+
try_files $uri /index.php$is_args$args;
105+
}
106+
107+
location ~ \.php$ {
108+
#NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
109+
include fastcgi_params;
110+
fastcgi_index index.php;
111+
fastcgi_pass docker_drupal;
112+
#The following parameter can be also included in fastcgi_params file
113+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
114+
}
115+
#
116+
access_log off;
117+
error_log /var/log/nginx/${NGINX_HOST}-81.error.log error;
118+
}

0 commit comments

Comments
 (0)