[nginx] Use try_file instead of if.
authorAndreas Neustifter <andreas.neustifter@gmail.com>
Thu, 28 Jun 2018 19:15:06 +0000 (19:15 +0000)
committerAndreas Neustifter <andreas.neustifter@gmail.com>
Mon, 9 Jul 2018 10:42:32 +0000 (12:42 +0200)
See https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/?utm_source=tool.lu#check-if-file-exists.

mods/sample-nginx.config

index 0c54438..e4ce902 100644 (file)
@@ -84,9 +84,7 @@ server {
 
   # rewrite to front controller as default rule
   location / {
-    if (!-e $request_filename) {
-      rewrite ^(.*)$ /index.php?pagename=$1;
-    }
+    try_file $uri /index.php?pagename=$uri&$args;
   }
 
   # make sure webfinger and other well known services aren't blocked