In a subfolder in the domain I want to install a Wordpress blog. I am using nginx. The URL to access the blog should be:example.com/blog
The site configuration is as follows:
server {
listen 80;
listen [::]:80;
root /var/www/example.com/html;
index index.php index.html index.htm index.nginx-debian.html;
server_name example.com www.example.com;
location /blog {
alias /var/www/example.comblog/html;
index index.php;
try_files $uri $uri/ /blog/index.php?q=$uri&$args;
}
location ~ /blog/.+\.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
The wordpress files are in the folder
/var/www/example.comblog/html. When accessing example.com/blog, the browser shows a 404 error.
In /etc/php5/fpm/php.iniI adapted this:cgi.fix_pathinfo=0
nginx version: nginx / 1.6.2
/var/log/nginx/error.log doesn't show anything interesting
UPDATE 1:
After setting the error log for debugging (among others), the following lines appear. Perhaps this helps:
open index "/var/www/example.comblog/html/index.php"
internal redirect: "/blog/index.php?"
rewrite phase: 1
test location: "/blog"
test location: ~ "/blog/.+\.php$"
using configuration "/blog/.+\.php$"
http script var: "/blog/index.php"
trying to use file: "/blog/index.php" "/var/www/example.com/html/blog/index.php"
Does internal redirection seem wrong? And the last line should be /var/www/example.comblog/html/blog/index.phpinstead /var/www/example.com/html/blog/index.php. I suspect this is reason 404. Since it index.phpdoes not exist /var/www/example.com/html/blog/index.php.
Update 2:
, , try_files.