I'm using the following nginx block to route mysite.com/blog to my /var/www/mysite/wordpress/ directory:
location /blog {
root /var/www/mysite/wordpress;
rewrite ^/blog/(.+)$ /$1 break;
try_files $uri $uri/ /blog/index.php?q=$uri&$args;
index index.php;
location ~ \.php {
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_split_path_info ^(?:\/blog)(.+\.php)(.*);
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
Everything works fine, except mysite.com/blog/wp-admin/ gives me a 404 error. Visiting mysite.com/blog/wp-admin/index.php works as expected, so it looks like my index rule is not working. What could be the issue here?
It's possible to solve this issue using
alias
directive: