bbcdf5754f0b

Fix feed redirection
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Fri, 07 Oct 2016 13:01:20 +0000
parents 954bb5f0facd
children 47ac3522d059
branches/tags (none)
files nginx.conf

Changes

--- a/nginx.conf	Fri Oct 07 12:50:39 2016 +0000
+++ b/nginx.conf	Fri Oct 07 13:01:20 2016 +0000
@@ -4,15 +4,14 @@
     rewrite ^/(.*) http://stevelosh.com/$1 permanent;
 }
 server {
-    listen   80;
+    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.html { return 301 /index.xml; }
+    location = /feed/ { return 301 /index.xml; }
 
     location / {
         root   /var/www/stevelosh.com/;
@@ -37,7 +36,7 @@
             break;
         }
 
-        if ($request_uri ~ ^.+[^/]$) {
+        if ($request_filename ~ ^.+[^/]$) {
             rewrite ^/(.*)$ /$1/ permanent;
             break;
         }
@@ -55,6 +54,15 @@
             rewrite ^/(.*)$ /$1.html;
             break;
         }
+
+        if (!-f $request_filename.html) {
+            break;
+        }
+    }
+
+    error_page 404 /404.html;
+    location = /404.html {
+        root /var/www/stevelosh.com/;
     }
 }