Skip to content

Commit 2d321e9

Browse files
committed
Add NGINX_INDEX
1 parent 830c323 commit 2d321e9

File tree

5 files changed

+22
-14
lines changed

5 files changed

+22
-14
lines changed

README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,15 @@ Coming Soon...
2525

2626
## Options
2727

28-
| Variable | Default | Description of Environment Variable |
29-
| :---------- | :------------: | :------------------------------------------------- |
30-
| STATIC | /static | Nginx root directory |
31-
| SUID | 1000 | Directory group/user ID |
32-
| GZIP_TYPES | `*` | Nginx gzip_types, set `off` to disable |
33-
| GZIP_LENGTH | `1000` | Minimum content size to compress |
34-
| BASIC_AUTH | - | Basic auth file contents |
35-
| BASIC_REALM | `Unauthorized` | Minimum content size to compress |
28+
| Variable | Default | Description of Environment Variable |
29+
| :---------- | :--------------------: | :------------------------------------------------- |
30+
| STATIC | /static | Nginx root directory |
31+
| SUID | 1000 | Directory group/user ID |
32+
| NGINX_INDEX | `index.html index.htm` | Nginx directory index files |
33+
| GZIP_TYPES | `*` | Nginx gzip_types, set `off` to disable |
34+
| GZIP_LENGTH | `1000` | Minimum content size to compress |
35+
| BASIC_AUTH | - | Basic auth file contents |
36+
| BASIC_REALM | `Unauthorized` | Minimum content size to compress |
3637

3738
See the [src/10-setup.sh](src/10-setup.sh) file for more details.
3839

docker-compose-swarm.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ services:
3636
# memory: 64M
3737
# volumes:
3838
# - static:/home/${USER_NAME:-foo}/static
39-
# - config:/etc/ssh/
39+
# - config:/etc/ssh
4040
# ports:
4141
# - "${SSH_PORT:-2222}:22"
4242

docker-compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ services:
3131
memory: 64M
3232
volumes:
3333
- static:/home/${USER_NAME:-foo}/static
34-
- config:/etc/ssh/
34+
- config:/etc/ssh
3535
ports:
3636
- "${SSH_PORT:-2222}:22"
3737

src/10-setup.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,15 @@ set -e
44

55
echo "Running: ${0}"
66

7-
echo "STATIC: ${STATIC:-/static}"
7+
_NGINX_INDEX="index.html index.htm"
8+
_STATIC="/static"
9+
10+
echo "STATIC: ${STATIC:-$_STATIC}"
811
echo "SUID: ${SUID:-1000}"
12+
echo "NGINX_INDEX: ${NGINX_INDEX:=$_NGINX_INDEX}"
13+
14+
sed "s/NGINX_INDEX/${NGINX_INDEX:=$_NGINX_INDEX}/g" \
15+
-i /etc/nginx/nginx.conf
916

1017
: "${GZIP_TYPES:=*}"
1118
echo "GZIP_TYPES: ${GZIP_TYPES}"
@@ -27,8 +34,8 @@ auth_basic_user_file /etc/nginx/auth.users;
2734
EOF
2835
fi
2936

30-
echo "+ chown -R ${SUID:-1000}:${SUID:-1000} ${STATIC:-/static}"
31-
chown -R "${SUID:-1000}:${SUID:-1000}" "${STATIC:-/static}"
37+
echo "+ chown -R ${SUID:-1000}:${SUID:-1000} ${STATIC:-$_STATIC}"
38+
chown -R "${SUID:-1000}:${SUID:-1000}" "${STATIC:-$_STATIC}"
3239

3340
echo "${0} - Done"
3441

src/nginx.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ http {
2424

2525
location / {
2626
root /static;
27-
index index.html index.htm index;
27+
index NGINX_INDEX;
2828
autoindex on;
2929
include /etc/nginx/conf.d/location.*;
3030
}

0 commit comments

Comments
 (0)