我已经清理了我的nginxconfiguration,用try_filesreplace了所有的if ,但是最后一个是我的。 只有当HTTP方法不是 DELETE我才能像try_files一样行事。 删除用于删除caching的文件。
感谢您的灯光!
location / { if ($request_method ~ ^DELETE$) { rewrite ^/(.+)$ /index.php?url=$1 last; } if (-e $request_filename) { break; } if (!-e $request_filename) { rewrite ^/(.+)$ /index.php?url=$1 last; } }
顺便说一句:我越想这个,就越是觉得不安全。
我find的解决scheme是保持第一个if但用更好的try_filesreplace其他两个。
location / { if ($request_method ~ ^DELETE$) { rewrite ^ /index.php last; } try_files $uri $uri/ /index.php?$args; }