Trying to install wordpress inside rails app with nginx and fastcgi

pinouchon asked:

I have a rails app (let’s call it myapp) running at I want to add a wordpress blog at The webserver for the rails app is thin (see the upstream block). The wordpress runs with php-fastcgi.

The rails app works fine. My problem is the following: in /home/myapp/myapp/log/error.log error I get:

2013/06/24 10:19:40 [error] 26066#0: *4 connect() failed (111: Connection refused) while connecti
ng to upstream, client: xx.xx.138.20, server:, request: "GET /blog/ HTTP/1.1", 
upstream: "fastcgi://", host: ""

Here is the nginx conf file:

upstream  myapp {
   server   unix:/tmp/thin_myapp.0.sock;
   server   unix:/tmp/thin_myapp.1.sock;
   server   unix:/tmp/thin_myapp2.sock;

server {
    listen       80;
    client_max_body_size 20M;

        access_log /home/myapp/myapp/log/access.log;
        error_log  /home/myapp/myapp/log/error.log error;
        root       /home/myapp/myapp/public;
        index      index.html;

         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    off;

            # Index HTML Files                                                                
            if (-f $document_root/cache/$uri/index.html) {
                rewrite (.*) /cache/$1/index.html break;

            if (!-f $request_filename) {
                proxy_pass http://myapp;
           #  try_files /system/maintenance.html $uri $uri/index.html $uri.html @ruby;        


         location /blog/ {
             root               /var/www/wordpress;
             fastcgi_index  index.php;

             if (!-e $request_filename) {
                 rewrite  ^(.*)$  /blog/index.php?q=$1  last;

             include /etc/nginx/fastcgi_params;
             fastcgi_param  SCRIPT_FILENAME    /var/www/wordpress$fastcgi_script_name;
             fastcgi_pass   localhost:9000;  # port to FastCGI                                           


Any ideas why that doesn’t work ? How do I make sure that php-factcgi is configured properly ?

I cant test if fastcgi is running with telnet:

$> telnet 9000
telnet: Unable to connect to remote host: Connection refused

And it’s not.

My answer:

php-fpm is not running. Just start it.

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.