Skip to content

Instantly share code, notes, and snippets.

@cbednarski
Created March 13, 2013 04:52
Show Gist options
  • Save cbednarski/5149466 to your computer and use it in GitHub Desktop.
Save cbednarski/5149466 to your computer and use it in GitHub Desktop.
Example nginx.conf for custom error pages
server {
listen 80;
server_name HOSTNAME;
root /opt/PATH/;
index index.html;
rewrite ^/$ /en/PATH/ redirect;
error_page 403 /403.html;
error_page 404 /404.html;
error_page 500 /500.html;
error_page 502 /502.html;
error_page 503 /503.html;
error_page 504 /504.html;
location / {
try_files $uri $uri/ index.html;
}
location ~ /([0-9]{3}).html {
try_files $1.html @error;
internal;
}
location @error {
root /opt/error-pages;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment