fix: don't use default nginx image error page
This commit is contained in:
parent
55be5f3522
commit
75e4c0dee6
5 changed files with 9 additions and 7 deletions
|
@ -22,7 +22,8 @@ RUN echo -e "\ninclude /etc/nginx/toplevel.conf.d/*.conf;" >> /etc/nginx/nginx.c
|
||||||
&& sed -i -e '/^\}$/{s//\}\nworker_rlimit_nofile 20480;/;:a' -e '$!N;$!ba' -e '}' /etc/nginx/nginx.conf \
|
&& sed -i -e '/^\}$/{s//\}\nworker_rlimit_nofile 20480;/;:a' -e '$!N;$!ba' -e '}' /etc/nginx/nginx.conf \
|
||||||
&& mkdir -p '/etc/nginx/toplevel.conf.d' \
|
&& mkdir -p '/etc/nginx/toplevel.conf.d' \
|
||||||
&& mkdir -p '/etc/nginx/dhparam' \
|
&& mkdir -p '/etc/nginx/dhparam' \
|
||||||
&& mkdir -p '/etc/nginx/certs'
|
&& mkdir -p '/etc/nginx/certs' \
|
||||||
|
&& mkdir -p '/usr/share/nginx/html/errors'
|
||||||
|
|
||||||
# Install Forego + docker-gen
|
# Install Forego + docker-gen
|
||||||
COPY --from=forego /usr/local/bin/forego /usr/local/bin/forego
|
COPY --from=forego /usr/local/bin/forego /usr/local/bin/forego
|
||||||
|
|
|
@ -19,7 +19,8 @@ RUN echo "\ninclude /etc/nginx/toplevel.conf.d/*.conf;" >> /etc/nginx/nginx.conf
|
||||||
&& sed -i -e '/^\}$/{s//\}\nworker_rlimit_nofile 20480;/;:a' -e '$!N;$!ba' -e '}' /etc/nginx/nginx.conf \
|
&& sed -i -e '/^\}$/{s//\}\nworker_rlimit_nofile 20480;/;:a' -e '$!N;$!ba' -e '}' /etc/nginx/nginx.conf \
|
||||||
&& mkdir -p '/etc/nginx/toplevel.conf.d' \
|
&& mkdir -p '/etc/nginx/toplevel.conf.d' \
|
||||||
&& mkdir -p '/etc/nginx/dhparam' \
|
&& mkdir -p '/etc/nginx/dhparam' \
|
||||||
&& mkdir -p '/etc/nginx/certs'
|
&& mkdir -p '/etc/nginx/certs' \
|
||||||
|
&& mkdir -p '/usr/share/nginx/html/errors'
|
||||||
|
|
||||||
# Install Forego + docker-gen
|
# Install Forego + docker-gen
|
||||||
COPY --from=forego /usr/local/bin/forego /usr/local/bin/forego
|
COPY --from=forego /usr/local/bin/forego /usr/local/bin/forego
|
||||||
|
|
|
@ -799,14 +799,14 @@ Per virtual-host `servers_tokens` directive can be configured by passing appropr
|
||||||
|
|
||||||
### Custom error page
|
### Custom error page
|
||||||
|
|
||||||
To override the default (nginx provided) error page displayed on 50x errors, mount your custom HTML error page inside the container at `/usr/share/nginx/html/50x.html`:
|
To override the default (nginx provided) error page displayed on 50x errors, mount your custom HTML error page inside the container at `/usr/share/nginx/html/errors/50x.html`:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
docker run --detach \
|
docker run --detach \
|
||||||
--name nginx-proxy \
|
--name nginx-proxy \
|
||||||
--publish 80:80 \
|
--publish 80:80 \
|
||||||
--volume /var/run/docker.sock:/tmp/docker.sock:ro \
|
--volume /var/run/docker.sock:/tmp/docker.sock:ro \
|
||||||
--volume /path/to/error.html:/usr/share/nginx/html/50x.html:ro \
|
--volume /path/to/error.html:/usr/share/nginx/html/errors/50x.html:ro \
|
||||||
nginxproxy/nginx-proxy:1.5
|
nginxproxy/nginx-proxy:1.5
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -703,10 +703,10 @@ server {
|
||||||
}
|
}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
{{- if (exists "/usr/share/nginx/html/50x.html") }}
|
{{- if (exists "/usr/share/nginx/html/errors/50x.html") }}
|
||||||
error_page 500 502 503 504 /50x.html;
|
error_page 500 502 503 504 /50x.html;
|
||||||
location /50x.html {
|
location /50x.html {
|
||||||
root /usr/share/nginx/html;
|
root /usr/share/nginx/html/errors;
|
||||||
internal;
|
internal;
|
||||||
}
|
}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
|
@ -5,4 +5,4 @@ services:
|
||||||
image: nginxproxy/nginx-proxy:test
|
image: nginxproxy/nginx-proxy:test
|
||||||
volumes:
|
volumes:
|
||||||
- /var/run/docker.sock:/tmp/docker.sock:ro
|
- /var/run/docker.sock:/tmp/docker.sock:ro
|
||||||
- ./50x.html:/usr/share/nginx/html/50x.html:ro
|
- ./50x.html:/usr/share/nginx/html/errors/50x.html:ro
|
||||||
|
|
Loading…
Reference in a new issue