Sorry again for the delay. Putting out proverbial fires the past 2 days.
Some background: my site is built on Symfony PHP Framework. I needed to add a blog to /blog/ and decided to go ahead and use wordpress for that piece so that my client can have full creative control there. I had two git repositories for source control and a build process to move from dev to qa to production environments. Almost all of my headaches around making this work can be traced to 1 concept: the location is based off of my main server: www.mysitesdomain.com --- so ~ /blog/ means www.mysitesdomain.com/blog/, AAAANND the location is also used for your location's root. So if your location's root is /var/www/mysite, it's going to look in /blog/ there. If you're wordpress installation is in /var/www/mysite/wordpress, then you need a /blog/ directory in there. I really hope you're having the same kind of issue. Here is my nginx config for just the wordpress piece. Maybe a real nginx expert will see all this and educate us both haha ;)
location ~ /blog/.*\.php(/|$) {
root <the full path to your wordpress installation, one directory up, with no trailing slash. ie: /var/www/mysite/wordpress is what you want here, and wordpress is /var/www/mysite/wordpress/blog/index.php>;
fastcgi_pass 127.0.0.1:9000; #### This is the local host and the port that the php-fpm service is running on
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS off;
}
# this is right out of the wordpress codex for static resources
location ~ /blog/.*\.(css|js|jpg|png|gif)$ {
root <the full path to your wordpress installation with no trailing slash. ie: /var/www/mysite/wordpress>;
}
# needed this for admin to work right
location /blog/wp-admin {
root<the full path to your wordpress installation with no trailing slash. ie: /var/www/mysite/wordpress>;
index index.php index.html;
if (!-f $request_filename) {
rewrite ^/blog/wp-admin$ /blog/wp-admin/ last;
}
}
# setting the index here didn't do it for me, so I did try_files and that worked like a charm.
location /blog/ {
root <the full path to your wordpress installation with no trailing slash. ie: /var/www/mysite/wordpress>;
try_files /blog/index.php$is_args$args /index.html;
fastcgi_pass 127.0.0.1:9000; #### This is the local host and the port that the php-fpm service is running on
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS off;
}
Some background: my site is built on Symfony PHP Framework. I needed to add a blog to /blog/ and decided to go ahead and use wordpress for that piece so that my client can have full creative control there. I had two git repositories for source control and a build process to move from dev to qa to production environments. Almost all of my headaches around making this work can be traced to 1 concept: the location is based off of my main server: www.mysitesdomain.com --- so ~ /blog/ means www.mysitesdomain.com/blog/, AAAANND the location is also used for your location's root. So if your location's root is /var/www/mysite, it's going to look in /blog/ there. If you're wordpress installation is in /var/www/mysite/wordpress, then you need a /blog/ directory in there. I really hope you're having the same kind of issue. Here is my nginx config for just the wordpress piece. Maybe a real nginx expert will see all this and educate us both haha ;)
location ~ /blog/.*\.php(/|$) {
root <the full path to your wordpress installation, one directory up, with no trailing slash. ie: /var/www/mysite/wordpress is what you want here, and wordpress is /var/www/mysite/wordpress/blog/index.php>;
fastcgi_pass 127.0.0.1:9000; #### This is the local host and the port that the php-fpm service is running on
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS off;
}
# this is right out of the wordpress codex for static resources
location ~ /blog/.*\.(css|js|jpg|png|gif)$ {
root <the full path to your wordpress installation with no trailing slash. ie: /var/www/mysite/wordpress>;
}
# needed this for admin to work right
location /blog/wp-admin {
root<the full path to your wordpress installation with no trailing slash. ie: /var/www/mysite/wordpress>;
index index.php index.html;
if (!-f $request_filename) {
rewrite ^/blog/wp-admin$ /blog/wp-admin/ last;
}
}
# setting the index here didn't do it for me, so I did try_files and that worked like a charm.
location /blog/ {
root <the full path to your wordpress installation with no trailing slash. ie: /var/www/mysite/wordpress>;
try_files /blog/index.php$is_args$args /index.html;
fastcgi_pass 127.0.0.1:9000; #### This is the local host and the port that the php-fpm service is running on
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS off;
}