Here's my single Linux VPS setup:
- A Rails app run by a Thin application server behind Nginx.
- A WordPress blog run by lighttpd's spawn-fcgi behind the same Nginx server.
Here's what I want:
Both apps running under the same domain. All URIs starting with /blog or /wp-, or ending with .php, should go to the fastcgi server. Everything else should go to the Thin server.
Here's my problem:
My Rails app works fine. The front of my WordPress blog works fine. I cannot, however, access the WordPress admin panel (/wp-admin or /wp-login.php). The problem must be with my Nginx conf.
Here's my Nginx conf:
upstream myserver {
server unix:/tmp/myserver.0.sock;
server unix:/tmp/myserver.1.sock;
}
server {
server_name myserver;
root /path/to/rails/app/public;
index index.html;
access_log /path/to/rails/app/log/access.log;
error_log /path/to/rails/app/log/error.log;
<snip>
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect false;
if (-f $document_root/cache$request_uri/index.html) {
rewrite (.*) /cache$1/index.html break;
}
if (-f $document_root/cache$request_uri.html) {
rewrite (.*) /cache$1.html break;
}
if (!-f $request_filename) {
proxy_pass http://myserver;
break;
}
}
location ~ /(blog|wp-).* {
root /path/to/wordpress;
index index.php;
access_log /path/to/wordpress/log/access.log;
error_log /path/to/wordpress/log/error.log;
if (!-e $request_filename) {
rewrite ^ /index.php last;
}
}
#
# pass the PHP scripts to FastCGI server
location ~ \.php$ {
root /path/to/wordpress;
index index.php;
access_log /path/to/wordpress/log/access.log;
error_log /path/to/wordpress/log/error.log;
fastcgi_pass unix:/tmp/fcgi.sock;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME /path/to/wordpress/$fastcgi_script_name;
}
}
When I turn on debug logging to the WordPress error log. I never see a match for /wp-admin when I request it. That leads me to believe the request is being handled by the location /
rule, which is intended for the Rails app. When I do request /wp-admin I'm prompted by the browser to "save as" some file named "download."
Note that assets under the wp-content directory are served up fine as they hit the location ~ /(blog|wp-).*
rule (why doesn't /wp-admin hit there?!)
My Question:
What rules do I need to have my desired setup and be able to acces the WP admin panel?
Thanks in advance.