Skip to content

Commit a926d84

Browse files
author
apedik
committed
Switch production/developer mode with varnish
1 parent 1050938 commit a926d84

File tree

7 files changed

+788
-2
lines changed

7 files changed

+788
-2
lines changed

docker/nginx/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ RUN usermod -u $USERID nginx
88
RUN groupmod -o -g $GROUPID nginx
99

1010
ADD nginx.conf /etc/nginx/nginx.conf
11-
ADD default.conf /etc/nginx/conf.d/default.conf
11+
ADD default-dev.conf /etc/nginx/conf.d/default.conf
1212
ADD m-hosts.conf /etc/nginx/conf.d/z-m-hosts.conf
13-
ADD m-servers.conf /etc/nginx/conf.d/z-m-servers.conf
13+
ADD m-servers-dev.conf /etc/nginx/conf.d/z-m-servers.conf
1414
ADD m-certs.conf /etc/nginx/conf.d/z-m-certs.conf
1515

1616
# SSL

docker/nginx/Dockerfile-prod

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
FROM nginx:1.25
2+
ARG USERID=1000
3+
ARG GROUPID=1000
4+
RUN groupmod -g 999 dialout
5+
6+
# fix www-data user to avoid permissions issues
7+
RUN usermod -u $USERID nginx
8+
RUN groupmod -o -g $GROUPID nginx
9+
10+
ADD nginx.conf /etc/nginx/nginx.conf
11+
ADD default-prod.conf /etc/nginx/conf.d/default.conf
12+
ADD m-hosts.conf /etc/nginx/conf.d/z-m-hosts.conf
13+
ADD m-servers-prod.conf /etc/nginx/conf.d/z-m-servers.conf
14+
ADD m-certs.conf /etc/nginx/conf.d/z-m-certs.conf
15+
16+
# SSL
17+
ADD certs/* /etc/ssl/certs/
18+
ADD certs/* /etc/ssl/private/
19+
RUN whoami
20+
RUN chown -R -f nginx: /etc/ssl /var/cache/nginx /var/log/nginx /var/run /var/run/*
21+
22+
EXPOSE 443

docker/nginx/default-dev.conf

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
server {
2+
listen 80;
3+
server_name _;
4+
5+
access_log /var/log/nginx/default.access.log main;
6+
7+
location / {
8+
root /var/www/htdocs/;
9+
index index.html index.htm index.php;
10+
}
11+
12+
#error_page 404 /404.html;
13+
14+
# redirect server error pages to the static page /50x.html
15+
#
16+
error_page 500 502 503 504 /50x.html;
17+
location = /50x.html {
18+
root /usr/share/nginx/html;
19+
}
20+
21+
# pass the PHP scripts to FastCGI server
22+
#
23+
location ~ \.php$ {
24+
set $php_host ${PHP_HOSTM2};
25+
fastcgi_pass ${php_host}:9000;
26+
fastcgi_index index.php;
27+
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
28+
include fastcgi_params;
29+
}
30+
31+
# deny access to .htaccess files, if Apache's document root
32+
location ~ /\.ht {
33+
deny all;
34+
}
35+
}
36+

docker/nginx/default-prod.conf

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
server {
2+
listen 8080;
3+
server_name _;
4+
5+
access_log /var/log/nginx/default.access.log main;
6+
7+
location / {
8+
root /var/www/htdocs/;
9+
index index.html index.htm index.php;
10+
}
11+
12+
#error_page 404 /404.html;
13+
14+
# redirect server error pages to the static page /50x.html
15+
#
16+
error_page 500 502 503 504 /50x.html;
17+
location = /50x.html {
18+
root /usr/share/nginx/html;
19+
}
20+
21+
# pass the PHP scripts to FastCGI server
22+
#
23+
location ~ \.php$ {
24+
set $php_host ${PHP_HOSTM2};
25+
fastcgi_pass ${php_host}:9000;
26+
fastcgi_index index.php;
27+
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
28+
include fastcgi_params;
29+
}
30+
31+
# deny access to .htaccess files, if Apache's document root
32+
location ~ /\.ht {
33+
deny all;
34+
}
35+
}
36+

0 commit comments

Comments
 (0)