File tree Expand file tree Collapse file tree 3 files changed +14
-2
lines changed Expand file tree Collapse file tree 3 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ Coming Soon...
3030| STATIC | /static | Nginx root directory |
3131| SUID | 1000 | Directory group/user ID |
3232| NGINX_INDEX | ` index.html index.htm ` | Nginx directory index files |
33+ | ERROR_PAGE | ` /404.html ` | Nginx 404 page, set ` off ` to disable |
3334| GZIP_TYPES | ` * ` | Nginx gzip_types, set ` off ` to disable |
3435| GZIP_LENGTH | ` 1000 ` | Minimum content size to compress |
3536| BASIC_AUTH | - | Basic auth file contents |
Original file line number Diff line number Diff line change @@ -14,21 +14,31 @@ echo "NGINX_INDEX: ${NGINX_INDEX:=$_NGINX_INDEX}"
1414sed " s/NGINX_INDEX/${NGINX_INDEX:= $_NGINX_INDEX } /g" \
1515 -i /etc/nginx/nginx.conf
1616
17+ rm -f /etc/nginx/conf.d/http.gzip.conf
18+ rm -f /etc/nginx/conf.d/location.auth.conf
19+ rm -f /etc/nginx/auth.users
20+
1721: " ${GZIP_TYPES:=* } "
1822echo " GZIP_TYPES: ${GZIP_TYPES} "
1923if [ " ${GZIP_TYPES} " != " off" ]; then
20- cat << EOF > /etc/nginx/conf.d/http.gzip.conf
24+ cat << EOF >> /etc/nginx/conf.d/http.gzip.conf
2125gzip on;
2226gzip_proxied any;
2327gzip_min_length ${GZIP_LENGTH:- 1000} ;
2428gzip_types ${GZIP_TYPES} ;
2529EOF
2630fi
2731
32+ : " ${ERROR_PAGE:=/ 404.html} "
33+ if [ " ${ERROR_PAGE} " != " off" ]; then
34+ echo " ERROR_PAGE: ${ERROR_PAGE} "
35+ echo " error_page 404 ${ERROR_PAGE} ;" >> /etc/nginx/conf.d/location.auth.conf
36+ fi
37+
2838if [ -n " ${BASIC_AUTH} " ]; then
2939echo " BASIC_AUTH: ${BASIC_AUTH} "
3040printf ' %s' " ${BASIC_AUTH} " > /etc/nginx/auth.users
31- cat << EOF > /etc/nginx/conf.d/location.auth.conf
41+ cat << EOF >> /etc/nginx/conf.d/location.auth.conf
3242auth_basic "${BASIC_REALM:- Unauthorized} ";
3343auth_basic_user_file /etc/nginx/auth.users;
3444EOF
Original file line number Diff line number Diff line change 2626 root /static;
2727 index NGINX_INDEX;
2828 autoindex on;
29+ try_files $uri $uri .html $uri / =404 ;
2930 include /etc/nginx/conf.d/location .*;
3031 }
3132 }
You can’t perform that action at this time.
0 commit comments