I have a running app using rails (unicorn) and nginx. My client asked me to move a wordpress blog onto existing server as a subfolder. Let's assume current site is www.example.com. The blog link should be www.example.com/blog I do not succeed to configure nginx to server wordpress blog. My current nginx configuration is:
upstream app_server_dinchi {
server unix:/tmp/.sock fail_timeout=0;
}
server {
listen 80;
server_name example.com www.example.com;
keepalive_timeout 5;
root /home/ubuntu/websites/example_staging/current/public;
try_files $uri/index.html $uri.html $uri @app;
location @app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://app_server_dinchi;
}
#blog configuration
location /blog {
root /home/ubuntu/websites/blog.example.com;
index index.php;
}
location ~ /blog/.+\.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME /home/ubuntu/websites/blog.example.com$fastcgi_script_name;
}
location ~* \.(js|css|png|jpg|gif)$ {
if ($query_string ~ "^[0-9]+$") {
expires max;
break;
}
}
error_page 500 502 503 504 /500.html;
location = /500.html {
root /home/ubuntu/websites/example_staging/current/public;
}
}
When I try to access example.com/blog I receive 404. Can somebody point to me how to add this subfolder?