I'm currently trying to integrate WordPress with an existing Laravel codebase.
I can access files in /var/www/src/blog
directly, for instance, site.com/blog/example.php
but I'm not able to access the index.php
via mysite.com/blog/
, so I'm unsure whether the issue is specific to my NGINX config or wordpress itself. Any help is much appreciated.
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;
}
}
}
Error Log
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/(.*)$"
Note: I omitted for readability, but the following was logged several time, presumably I somehow caused a loop?
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 "/"
Full log (in debug mode): http://pastebin.com/ZdZj40M1