fix: don't use default nginx image error page

This commit is contained in:
Nicolas Duchon 2024-05-21 13:23:45 +02:00
parent 55be5f3522
commit 75e4c0dee6
No known key found for this signature in database
GPG key ID: EA3151C66A4D79E7
5 changed files with 9 additions and 7 deletions

View file

@ -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 \
&& mkdir -p '/etc/nginx/toplevel.conf.d' \
&& 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
COPY --from=forego /usr/local/bin/forego /usr/local/bin/forego

View file

@ -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 \
&& mkdir -p '/etc/nginx/toplevel.conf.d' \
&& 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
COPY --from=forego /usr/local/bin/forego /usr/local/bin/forego

View file

@ -799,14 +799,14 @@ Per virtual-host `servers_tokens` directive can be configured by passing appropr
### 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
docker run --detach \
--name nginx-proxy \
--publish 80:80 \
--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
```

View file

@ -703,10 +703,10 @@ server {
}
{{- 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;
location /50x.html {
root /usr/share/nginx/html;
root /usr/share/nginx/html/errors;
internal;
}
{{- end }}

View file

@ -5,4 +5,4 @@ services:
image: nginxproxy/nginx-proxy:test
volumes:
- /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