server { listen 80; server_name _; root /usr/share/nginx/html/site; index index.html index.htm; autoindex off; rewrite ^/phpDocumentor.phar https://github.com/phpDocumentor/phpDocumentor/releases/latest/download/phpDocumentor.phar redirect; rewrite ^/get/phpDocumentor-(\d\.\d\.\d).phar https://github.com/phpDocumentor/phpDocumentor/releases/v$1/download/phpDocumentor.phar redirect; location ~ /(latest|[3-9+]\.[0-9])(/.*)? { try_files $2 $2/index.html =404; } location / { root /usr/share/nginx/html/site; } error_page 404 /404.html; error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } }