connect() failed (111: Connection refused) while connecting to upstream, client

bobbybackblech asked:

I get this error message in my log :

*329 connect() failed (111: Connection refused) while connecting to upstream, client: 37.24.154.207, server: domain.de, request: "POST /wp-admin/admin-ajax.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9065", host: "domain.de", referrer: "http://domain.de/wp-admin/edit.php?post_status=draft&post_type=post"

I dont know why ?

My nginx config:

server {
        listen xx.xx.xx.xx:80;


        server_name domain.de www.domain.de;

        root   /var/www/domain.de/web;

        if ($http_host = "www.domain.de") {
            rewrite ^ $scheme://domain.de$request_uri? permanent;
        }


        index index.html index.htm index.php index.cgi index.pl index.xhtml;



        error_page 400 /error/400.html;
        error_page 401 /error/401.html;
        error_page 403 /error/403.html;
        error_page 404 /error/404.html;
        error_page 405 /error/405.html;
        error_page 500 /error/500.html;
        error_page 502 /error/502.html;
        error_page 503 /error/503.html;
        recursive_error_pages on;
        location = /error/400.html {

            internal;
        }
        location = /error/401.html {

            internal;
        }
        location = /error/403.html {

            internal;
        }
        location = /error/404.html {

            internal;
        }
        location = /error/405.html {

            internal;
        }
        location = /error/500.html {

            internal;
        }
        location = /error/502.html {

            internal;
        }
        location = /error/503.html {

            internal;
        }

        error_log /var/log/ispconfig/httpd/domain.de/error.log;
        access_log /var/log/ispconfig/httpd/domain.de/access.log combined;

        location ~ /. {
            deny all;
            access_log off;
            log_not_found off;
        }

        location = /favicon.ico {
            log_not_found off;
            access_log off;
        }

        location = /robots.txt {
            allow all;
            log_not_found off;
            access_log off;
        }

        location /stats {

            index index.html index.php;
            auth_basic "Members Only";
            auth_basic_user_file /var/www/clients/clientx/webx/web/stats/.htpasswd_stats;
        }

        location ^~ /awstats-icon {
            alias /usr/share/awstats/icon;
        }

        location ~ .php$ {
            try_files /42e542cd7d9a862ffdaefe4211xxxxx.htm @php;
        }

        location @php {
            try_files $uri =404;
            include /etc/nginx/fastcgi_params;
            fastcgi_pass 127.0.0.1:9065;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_intercept_errors on;
        }





        client_max_body_size 100M;

        location / {
                        try_files $uri $uri/ /index.php?$args;
        }

        rewrite /wp-admin$ $scheme://$host$uri/ permanent;

        location ~* .(jpg|jpeg|png|gif|css|js|ico)$ {
                        expires max;
                        log_not_found off;
        }

                gzip_static on;
                set $supercacheuri "";
                set $supercachefile "$document_root/wp-content/cache/supercache/${http_host}${uri}index.html";
                if (-e $supercachefile) {
                    set $supercacheuri "/wp-content/cache/supercache/${http_host}${uri}index.html";
                }
                if ($request_method = POST) {
                    set $supercacheuri "";
                }
                if ($query_string) {
                    set $supercacheuri "";
                }
                if ($http_cookie ~* comment_author_|wordpress_logged_in|wp-postpass_) {
                    set $supercacheuri "";
                }
                if ($http_x_wap_profile) {
                    set $supercacheuri "";
                }
                if ($http_profile) {
                    set $supercacheuri "";
                }
                if ($http_user_agent ~* (2.0 MMP|240x320|400X240|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo|Elaine/3.0|EudoraWeb|Googlebot-Mobile|hiptop|IEMobile|KYOCERA/WX310K|LG/U990|MIDP-2.|MMEF20|MOT-V|NetFront|Newt|Nintendo Wii|Nitro|Nokia|Opera Mini|Palm|PlayStation Portable|portalmmm|Proxinet|ProxiNet|SHARP-TQ-GX10|SHG-i900|Small|SonyEricsson|Symbian OS|SymbianOS|TS21i-10|UP.Browser|UP.Link|webOS|Windows CE|WinWAP|YahooSeeker/M1A1-R2D2|iPhone|iPod|Android|BlackBerry9530|LG-TU915 Obigo|LGE VX|webOS|Nokia5800)) {
                    set $supercacheuri "";
                }
                if ($http_user_agent ~* (w3c |w3c-|acs-|alav|alca|amoi|audi|avan|benq|bird|blac|blaz|brew|cell|cldc|cmd-|dang|doco|eric|hipt|htc_|inno|ipaq|ipod|jigs|kddi|keji|leno|lg-c|lg-d|lg-g|lge-|lg/u|maui|maxo|midp|mits|mmef|mobi|mot-|moto|mwbp|nec-|newt|noki|palm|pana|pant|phil|play|port|prox|qwap|sage|sams|sany|sch-|sec-|send|seri|sgh-|shar|sie-|siem|smal|smar|sony|sph-|symb|t-mo|teli|tim-|tosh|tsm-|upg1|upsi|vk-v|voda|wap-|wapa|wapi|wapp|wapr|webc|winw|winw|xda |xda-)) {
                    set $supercacheuri "";
                }
                if ($supercacheuri) {
                    rewrite ^ $supercacheuri break;
                }


}

My answer:


php-fpm is not running, or not listening on port 9065 (the port you chose).

Just check its configuration to make sure you put it on that port, and then 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.