Hi,
I have found the Wordpress on Nginx tutorials on the rtCamp site very helpful, but was wondering if you could recommend how to access "non-wordpress" subdirectories with Nginx.
I currently have Wordpress installed in /blog where / is the root of the site htdocs. I have created a folder at /api with a php file within and am trying to access the file through www.site.com/api.
The Nginx configuration has the root set to /blog and www.site.com goes to the Wordpress installation as expected. I have set a location /api under the server to have root at /api. When accessing www.site.com/api, a 404 occurs and goes to the Wordpress 404 page. Could you recommend a change in Nginx configuration to get this to work? Thanks.
Domain of site is geometrystash.com Current site conf file:
server {
server_name www.geometrystash.com;
rewrite ^(.*) http://geometrystash.com$1 permanent;
}
server {
listen 80;
server_name geometrystash.com;
root /var/www/geometrystash.com/htdocs/blog;
index index.php;
include /etc/nginx/security;
# Logging --
access_log off;
error_log /var/log/nginx/geometrystash.com.error.log warn;
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
# serve static files directly
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt)$ {
access_log off;
expires max;
}
location /api {
try_files $uri $uri/ /index.php?$args;
root /var/www/geometrystash.com/htdocs;
index index.php;
}
location ~ \.php$ {
try_files $uri $uri/ /index.php?$args;
fastcgi_pass unix:/var/run/php5-fpm/geometrystash.com.socket;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
}
}