File tree Expand file tree Collapse file tree 3 files changed +39
-1
lines changed
Expand file tree Collapse file tree 3 files changed +39
-1
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,34 @@ services:
3737 image : your-app-image # listens on port 8000
3838` ` `
3939
40+ ## Options
41+
42+ | Variable | Default | Description of Environment Variable |
43+ | :----------- | :------------: | :------------------------------------------------- |
44+ | SERVICE_NAME | ` app` | Hostname (service name) of container |
45+ | SERVICE_PORT | `8000` | Port service/container is listening on |
46+ | GZIP_TYPES | - | Nginx content gzip_types to compress |
47+ | GZIP_LENGTH | `1000` | Minimum content size to compress |
48+ | BASIC_AUTH | - | Basic auth file contents |
49+ | BASIC_REALM | `Unauthorized` | Minimum content size to compress |
50+
51+ # ### Basic Auth
52+
53+ ` ` ` shell
54+ $ htpasswd -nb user pass
55+ user:$apr1$XFVN0nJA$IgZxtMHVAeA.Pu7ufU7/I0
56+ ` ` `
57+
58+ Replace all `$` with `$$` for docker-compose.yaml files.
59+ Use `\n` for newlines to add multiple credentials.
60+
61+ ` ` ` yaml
62+ environment:
63+ BASIC_AUTH: 'user:$apr1$XFVN0nJA$IgZxtMHVAeA.Pu7ufU7/I0\n user2:$apr1$vswJgdwo$2XkDOrvJFQ2pKwrXqGeWM0'
64+ ` ` `
65+
66+ AI is Retarded.
67+
4068# # Examples
4169
4270If your app container is called `app` and listens on `3000` this will reverse proxy it to the `PORT` exposed on nginx.
Original file line number Diff line number Diff line change @@ -17,12 +17,21 @@ if [ -n "${GZIP_TYPES}" ];then
1717echo " GZIP_TYPES: ${GZIP_TYPES} "
1818cat << EOF > /etc/nginx/conf.d/http.gzip.conf
1919gzip on;
20- gzip_min_length 1000;
2120gzip_proxied any;
21+ gzip_min_length ${GZIP_LENGTH:- 1000} ;
2222gzip_types ${GZIP_TYPES} ;
2323EOF
2424fi
2525
26+ if [ -n " ${BASIC_AUTH} " ]; then
27+ echo " BASIC_AUTH: ${BASIC_AUTH} "
28+ printf ' %s' " ${BASIC_AUTH} " > /etc/nginx/auth.users
29+ cat << EOF > /etc/nginx/conf.d/location.auth.conf
30+ auth_basic "${BASIC_REALM:- Unauthorized} ";
31+ auth_basic_user_file /etc/nginx/auth.users;
32+ EOF
33+ fi
34+
2635echo " ${0} - Done"
2736
2837nginx -version || :
Original file line number Diff line number Diff line change 4141 proxy_set_header X-Forwarded-Host $server_name ;
4242 proxy_set_header Upgrade $http_upgrade ;
4343 proxy_set_header Connection "upgrade" ;
44+ include /etc/nginx/conf.d/location .*;
4445 }
4546 }
4647}
You can’t perform that action at this time.
0 commit comments