Docker-Docs/_deploy/nginx/default.conf

27 lines
976 B
Plaintext

server {
# Use relative redirects to account for situations where a front-end proxy is
# used and the container does not know the public domain and port
absolute_redirect off;
listen 4000;
error_page 403 404 /404.html;
root /usr/share/nginx/html;
index index.html;
# Enable aio for better performance (see https://www.nginx.com/blog/thread-pools-boost-performance-9x/)
aio threads;
location ~ ^/v([\d\.]+)/(.*)$ {
# Archive URLs: first try if the given file is still hosted, otherwise
# redirect to the same URL in the current version of the docs.
try_files $uri $uri/ @redirect_current;
}
location @redirect_current {
# Do a 301 (moved permanently) redirect of archive pages we didn't find
# to the same location in the current docs. Note that the location redirected
# to may not (or no longer) exist, and as such could result in another 301
# redirect, or a 404.
rewrite ^/v([\d\.]+)/(.*)$ /$2 permanent;
}
}