File tree Expand file tree Collapse file tree 3 files changed +14
-58
lines changed Expand file tree Collapse file tree 3 files changed +14
-58
lines changed Original file line number Diff line number Diff line change @@ -244,14 +244,14 @@ if [ "${NGINX_GZIP_ENABLE}" = 1 ]; then
244
244
cp /templates/gzip.conf /etc/nginx/conf.d/gzip.conf
245
245
fi
246
246
247
- # shellcheck disable=SC2016 # The envsubst command needs to be executed without variable expansion
248
- envsubst ' ${PHP_HOST} ${PHP_PORT} ${NGINX_ACCESS_LOG_FORMAT} ${NGINX_DEFAULT_SERVER_PORT} ${NGINX_DEFAULT_SERVER_NAME} ${NGINX_DEFAULT_ROOT} ${DEFAULT_SERVER} ${NGINX_XFRAME_OPTION_VALUE} ${NGINX_HSTS_HEADER} ${NGINX_CSP_HEADER}' < /templates/default.conf > /etc/nginx/conf.d/default.conf
249
-
250
247
if [ " ${NGINX_SUBFOLDER} " != 0 ]; then
251
- # shellcheck disable=SC2016 # The envsubst command needs to be executed without variable expansion
252
- envsubst ' ${PHP_HOST} ${PHP_PORT} ${NGINX_ACCESS_LOG_FORMAT} ${NGINX_DEFAULT_SERVER_PORT} ${NGINX_DEFAULT_SERVER_NAME} ${NGINX_DEFAULT_ROOT} ${NGINX_SUBFOLDER} ${NGINX_SUBFOLDER_ESCAPED} ${NGINX_XFRAME_OPTION_VALUE} ${NGINX_HSTS_HEADER} ' < /templates/subfolder.conf > /etc/nginx/conf.d/ default.conf
248
+ print " Activating subfolder configuration "
249
+ sed -e ' /#subfolder/r /templates/subfolder.conf' -i /templates/ default.conf;
253
250
fi
254
251
252
+ # shellcheck disable=SC2016 # The envsubst command needs to be executed without variable expansion
253
+ envsubst ' ${PHP_HOST} ${PHP_PORT} ${NGINX_ACCESS_LOG_FORMAT} ${NGINX_DEFAULT_SERVER_PORT} ${NGINX_DEFAULT_SERVER_NAME} ${NGINX_DEFAULT_ROOT} ${DEFAULT_SERVER} ${NGINX_SUBFOLDER} ${NGINX_SUBFOLDER_ESCAPED} ${NGINX_XFRAME_OPTION_VALUE} ${NGINX_HSTS_HEADER} ${NGINX_CSP_HEADER}' < /templates/default.conf > /etc/nginx/conf.d/default.conf
254
+
255
255
# Handle robots.txt and sitemap directive
256
256
ROBOTS_PATH=${NGINX_DEFAULT_ROOT} /robots.txt
257
257
if [ -n " ${SITEMAP_URL} " ] && [ -w " ${ROBOTS_PATH} " ] ; then
Original file line number Diff line number Diff line change @@ -58,6 +58,8 @@ server {
58
58
return 200;
59
59
}
60
60
61
+ #subfolder
62
+
61
63
location = /favicon.ico {
62
64
expires 30d;
63
65
# Google cloud cdn needs a Cache-Control: public header.
Original file line number Diff line number Diff line change 1
- upstream php {
2
- server ${PHP_HOST}:${PHP_PORT} ;
1
+ location ~ ${NGINX_SUBFOLDER}/(.*) {
2
+ try_files /$1 @rewrite ;
3
3
}
4
4
5
- map $http_x_forwarded_proto $fastcgi_https {
6
- default $https;
7
- http '';
8
- https on;
9
- }
10
-
11
- server {
12
- access_log /var/log/nginx/access.log ${NGINX_ACCESS_LOG_FORMAT};
13
-
14
- server_name ${NGINX_DEFAULT_SERVER_NAME};
15
- listen ${NGINX_DEFAULT_SERVER_PORT};
16
-
17
- root ${NGINX_DEFAULT_ROOT};
18
- index index.php;
19
-
20
- include fastcgi.conf;
21
- #hstsheader
22
- #httpsredirect
23
- #securityheaders
24
-
25
- include /etc/nginx/conf.d/fragments/*.conf;
26
-
27
- # Just return for google gclb healthcheck.
28
- if ($http_user_agent = 'GoogleHC/1.0') {
29
- return 200;
30
- }
31
-
32
- location ~ ${NGINX_SUBFOLDER}/(.*) {
33
- try_files /$1 @rewrite;
34
- }
35
-
36
- location @rewrite {
37
- rewrite ^ /index.php;
38
- }
39
-
40
- location ~ \.php$ {
41
- include fastcgi.conf;
42
- fastcgi_param SCRIPT_FILENAME $request_filename;
43
- fastcgi_pass php;
44
- }
45
-
46
- location ${NGINX_SUBFOLDER} {
47
- if ($http_x_forwarded_proto = "https") {
48
- return 301 https://$host$request_uri/;
49
- }
50
- return 301 http://$host$request_uri/;
51
- }
52
-
53
- location / {
54
- try_files $uri/ @rewrite;
55
- }
5
+ location ${NGINX_SUBFOLDER} {
6
+ if ($http_x_forwarded_proto = "https") {
7
+ return 301 https://$host$request_uri/;
8
+ }
9
+ return 301 http://$host$request_uri/;
56
10
}
You can’t perform that action at this time.
0 commit comments