nginx.conf @ 21e596ce4966

Commit updates from proofreading
author Steve Losh <steve@stevelosh.com>
date Mon, 21 May 2018 19:07:15 -0400
parents bbcdf5754f0b
children (none)
server {
    listen   80;
    server_name  www.stevelosh.com;
    rewrite ^/(.*) http://stevelosh.com/$1 permanent;
}
server {
    listen   80 default;
    server_name  stevelosh.com;

    access_log /tmp/stevelosh.com.access.log;
    error_log /tmp/stevelosh.com.error.log;

    location = /feed.html { return 301 /index.xml; }
    location = /feed/ { return 301 /index.xml; }

    location / {
        root   /var/www/stevelosh.com/;
        index  index.html;

        if ($request_uri ~ ^/blog/entry/\d+/\d/\d+/[^/]*/?$) {
            rewrite ^/blog/entry/(\d+)/(\d)/\d+/([^/]*)/?$ /blog/$1/0$2/$3/ permanent;
            break;
        }

        if ($request_uri ~ ^/blog/entry/\d+/\d\d/\d+/[^/]*/?$) {
            rewrite ^/blog/entry/(\d+)/(\d\d)/\d+/([^/]*)/?$ /blog/$1/$2/$3/ permanent;
            break;
        }

        if ($request_filename ~ ^.*.html$) {
            rewrite ^(.*).html$ $1/ permanent;
            break;
        }

        if (-f $request_filename) {
            break;
        }

        if ($request_filename ~ ^.+[^/]$) {
            rewrite ^/(.*)$ /$1/ permanent;
            break;
        }

        if (-f $request_filename/index.html) {
            rewrite ^(.*)/$ /$1/index.html;
            break;
        }

        if ($request_filename ~ ^.*/$) {
            rewrite ^/(.*)/$ /$1;
        }

        if (-f $request_filename.html) {
            rewrite ^/(.*)$ /$1.html;
            break;
        }

        if (!-f $request_filename.html) {
            break;
        }
    }

    error_page 404 /404.html;
    location = /404.html {
        root /var/www/stevelosh.com/;
    }
}