I’ve tried so many different things. The point I’m at right now is this:
location ^~ /wordpress {
alias /var/www/example.com/wordpress;
index index.php index.html index.htm;
try_files $uri $uri/ /wordpress/index.php;
location ~ .php$ {
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_split_path_info ^(/wordpress)(/.*)$;
fastcgi_param SCRIPT_FILENAME /var/www/example.com/wordpress/index.php;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}
Right now, all resources as far as I can tell (images, etc) are loading correctly. And http://www.example.com/wordpress
loads wordpress, but a page that says “page not found”. (WordPress is in use for this though). If I try any post urls I get the same result, “page not found”. So I know the problem is that wordpress isn’t obtaining the data about the path or something. Another potential problem is that if I run example.com/wp-admin.php
then it will still run index.php
.
What data needs to be passed? What may be going wrong here?
Since your location alias end match, you should just use root. Also, not everything is routed through index.php on wordpress afaik. Also, unless you know you need path info, you probably dont. I think you want something like:
or if you really do need path info (urls look like /wordpress/index.php/foo/bar):
EDIT: Updated first server{} to strip initial /wordpress from uri and pass remainder as q param
EDIT2: Named locations are only valid at server level
Dude, this will work for for a wordpress blog in a subdirectory of the magento root folder!
I had the same problem and this is what fixed it for me:
Open the NGINX configuration file for your site. Inside of the server block, add the path to your root directory and set the priority order for files:
Create an empty location block before all your other location blocks:
Commend out the root directory in your location / block and add the redirection so it looks like this:
Make sure that your location ~ .php$ block points its root to
This fixed it for me.