try_filesが、存在しないファイルのリクエストを最後に指定された値(私の場合はindex.php)に渡していないように見えるという問題があります。私はWordpressを使用しており、使用するXMLサイトマップジェネレータプラグインは、Wordpressによって処理される仮想XMLファイルと仮想robots.txtを作成します。残念ながら、try_filesはこれらのファイルのリクエストをWordpressに渡していないようです。
これが私のサーバー構成です:
server {
## Web domain
server_name christiaanconover.com;
## Site root
root /var/www/christiaanconover.com;
## Index
index index.php index.htm;
## Common Wordpress configuration
include wp.conf;
## Include PHP configuration
include php.conf;
## Gzip Compression
include gzip.conf;
## Include W3TC configuration
include /var/www/w3tc/christiaanconover.com;
}
このサーバーで複数の個別のWordpressサイトを実行しているので、時間を節約するために、Wordpressで一般的に使用されるすべての構成要素を含むファイルwp.confを作成しました。wp.confの内容は次のとおりです。
location / {
## Prevent PHP files from being served as static assets, and fall back to index.php if file does not exist
try_files $uri $uri/ /index.php?$args;
## If a file exists, serve it directly
if (-f $request_filename) {
break;
}
## Wordpress Rewrite
if (!-e $request_filename) {
rewrite ^ /index.php last;
}
}
他のすべては完全に機能していますが、try_filesの配置が適切に処理されていないようです。何か案は?