我目前正在尝试将WordPress与现有的Laravel代码库集成。
我可以直接访问/var/www/src/blog
中的文件,例如site.com/blog/example.php
,但我无法通过index.php
访问mysite.com/blog/
,所以我&#39 ;我不确定问题是否特定于我的NGINX配置或wordpress本身。非常感谢任何帮助。
server {
listen 80;
charset utf-8;
error_log /var/log/nginx/error.log debug;
index index.php index.html;
server_name ha_laravel.com;
sendfile off;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ /blog/(.*)$ {
root /var/www/src/blog;
try_files /$1 /$1/ /index.php?$args;
location ~ .*\/(.*php)$ {
try_files /$1 /index.php?$args;
include fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root/$1;
fastcgi_cache off;
}
}
}
2015/08/02 11:20:15 [debug] 24131#0: *1529 test location: "/" 2015/08/02 11:20:15 [debug] 24131#0: *1529 test location: ~ "/blog/(.*)$" 2015/08/02 11:20:15 [debug] 24131#0: *1529 test location: ~ ".*\/(.*php)$" 2015/08/02 11:20:15 [debug] 24131#0: *1529 using configuration "/blog/(.*)$" 2015/08/02 11:06:55 [debug] 24284#0: *1535 test location: "/" 2015/08/02 11:06:55 [debug] 24284#0: *1535 test location: ~ "/blog/(.*)$" 2015/08/02 11:06:55 [debug] 24284#0: *1535 test location: ~ ".*\/(.*php)$" 2015/08/02 11:06:55 [debug] 24284#0: *1535 using configuration "/blog/(.*)$"
注意:为了便于阅读,我省略了,但是多次记录以下内容,可能是因为我以某种方式引起了循环?
internal error. 2015/08/02 11:06:55 [debug] 24284#0: *1535 http cl:-1 max:1048576 2015/08/02 11:06:55 [debug] 24284#0: *1535 rewrite phase: 3 2015/08/02 11:06:55 [debug] 24284#0: *1535 post rewrite phase: 4 2015/08/02 11:06:55 [debug] 24284#0: *1535 generic phase: 5 2015/08/02 11:06:55 [debug] 24284#0: *1535 generic phase: 6 2015/08/02 11:06:55 [debug] 24284#0: *1535 generic phase: 7 2015/08/02 11:06:55 [debug] 24284#0: *1535 access phase: 8 2015/08/02 11:06:55 [debug] 24284#0: *1535 access phase: 9 2015/08/02 11:06:55 [debug] 24284#0: *1535 post access phase: 10 2015/08/02 11:06:55 [debug] 24284#0: *1535 try files phase: 11 2015/08/02 11:06:55 [debug] 24284#0: *1535 http script copy: "/" 2015/08/02 11:06:55 [debug] 24284#0: *1535 http script capture: "" 2015/08/02 11:06:55 [debug] 24284#0: *1535 trying to use file: "/" "/var/www/src/blog/" 2015/08/02 11:06:55 [debug] 24284#0: *1535 http script copy: "/" 2015/08/02 11:06:55 [debug] 24284#0: *1535 http script capture: "" 2015/08/02 11:06:55 [debug] 24284#0: *1535 trying to use dir: "/" "/var/www/src/blog/" 2015/08/02 11:06:55 [debug] 24284#0: *1535 try file uri: "/" 2015/08/02 11:06:55 [debug] 24284#0: *1535 content phase: 12 2015/08/02 11:06:55 [debug] 24284#0: *1535 open index "/var/www/src/blog/index.php" 2015/08/02 11:06:55 [debug] 24284#0: *1535 internal redirect: "/index.php?" 2015/08/02 11:06:55 [debug] 24284#0: *1535 rewrite phase: 1 2015/08/02 11:06:55 [debug] 24284#0: *1535 test location: "/" 2015/08/02 11:06:55 [debug] 24284#0: *1535 test location: ~ "/blog/(.*)$" 2015/08/02 11:06:55 [debug] 24284#0: *1535 using configuration "/"
完整日志(在调试模式下):http://pastebin.com/ZdZj40M1