bijuoos
By:
bijuoos

Getting Nginx fpm.sock error

June 7, 2015 80.9k views
Nginx WordPress PHP LEMP

My Droplet:

8 GB RAM
80 GB Space
4 Core CUP
$80 Monthly
Server : Nginx
Database : MySQL
I installed one click LEMP from the Admin panel and run a Wordpress site.

I'm getting errors like this everyday:

2015/06/06 14:04:27 [error] 12948#0: *19545859 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 123.201.237.162, server: www.mysite.com, request: "GET /telugu/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/"
2015/06/06 14:04:27 [error] 12946#0: *19546893 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 49.206.217.71, server: www.mysite.com, request: "GET /wp-content/themes/novavideo/css/large.php?responsive=yes&ver=4.1.1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/telugu/2015-telugu/"
2015/06/06 14:04:27 [error] 12948#0: *19546925 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 49.206.217.71, server: www.mysite.com, request: "GET /wp-content/themes/novavideo/css/horizontal.php?responsive=yes&ver=4.1.1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/telugu/2015-telugu/"
2015/06/06 14:04:30 [error] 12945#0: *19538751 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 49.207.96.9, server: www.mysite.com, request: "GET /wp-content/themes/novavideo/css/horizontal.php?responsive=yes&ver=4.1.1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/english/page/4/?display=tube&filtre=views"
2015/06/06 14:04:30 [error] 12945#0: *19547134 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 92.96.146.25, server: www.mysite.com, request: "GET /wp-content/themes/novavideo/css/large.php?responsive=yes&ver=4.1.1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/malayalam/"
2015/06/06 14:04:30 [error] 12945#0: *19547134 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 92.96.146.25, server: www.mysite.com, request: "GET /wp-content/themes/novavideo/css/horizontal.php?responsive=yes&ver=4.1.1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/malayalam/"
2015/06/06 14:04:30 [error] 12945#0: *19547134 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 92.96.146.25, server: www.mysite.com, request: "GET /wp-content/themes/novavideo/css/colors.php?color=00a5ae&ver=4.1.1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/malayalam/"
2015/06/06 14:04:30 [error] 12946#0: *19547510 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 31.49.58.222, server: www.mysite.com, request: "GET /wp-content/themes/novavideo/css/horizontal.php?responsive=yes&ver=4.1.1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/page25/"
2015/06/06 14:04:30 [error] 12946#0: *19547510 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 31.49.58.222, server: www.mysite.com, request: "GET /wp-content/themes/novavideo/css/colors.php?color=00a5ae&ver=4.1.1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/page25/"
2015/06/06 14:04:30 [error] 12946#0: *19542884 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 80.184.44.114, server: www.mysite.com, request: "GET /hindi/2015-hindi-hindi/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/malayalam/"
2015/06/06 14:04:30 [error] 12946#0: *19547502 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 210.212.190.49, server: www.mysite.com, request: "GET /avengers-2-age-ultron-movie-online-watch-hollywood-full-length-film-english-movie/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "https://www.google.co.in/"
2015/06/06 14:04:30 [error] 12945#0: *19547522 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 31.49.58.222, server: www.mysite.com, request: "GET /wp-content/themes/novavideo/css/large.php?responsive=yes&ver=4.1.1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/page25/"
2015/06/06 14:04:30 [error] 12945#0: *19547526 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 121.54.54.139, server: www.mysite.com, request: "GET /fast-furious-7-2015-full-movie-online-watch-english-full-length-film-hollywood-movie/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com"
2015/06/06 14:04:34 [error] 12945#0: *19545368 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 150.107.188.223, server: www.mysite.com, request: "GET /wp-content/themes/novavideo/css/colors.php?color=00a5ae&ver=4.1.1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/page36/"
2015/06/06 14:04:34 [error] 12947#0: *19547801 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 117.200.243.224, server: www.mysite.com, request: "GET /wp-content/themes/novavideo/css/colors.php?color=00a5ae&ver=4.1.1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/"
2015/06/06 14:04:46 [error] 12945#0: *19546882 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 175.139.172.22, server: www.mysite.com, request: "GET /wp-content/themes/novavideo/css/large.php?responsive=yes&ver=4.1.1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/page48/"
2015/06/06 14:04:46 [error] 12946#0: *19548721 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 87.210.127.11, server: www.mysite.com, request: "GET /wp-content/themes/novavideo/css/horizontal.php?responsive=yes&ver=4.1.1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/page25/"
2015/06/06 14:04:46 [error] 12946#0: *19548722 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 87.210.127.11, server: www.mysite.com, request: "GET /wp-content/themes/novavideo/css/colors.php?color=00a5ae&ver=4.1.1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/page25/"
2015/06/06 14:04:48 [error] 12946#0: *19548902 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 23.236.125.199, server: www.mysite.com, request: "GET /wp-content/themes/novavideo/css/colors.php?color=00a5ae&ver=4.1.1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/page78/"
2015/06/06 14:04:49 [error] 12947#0: *19548261 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 49.248.136.243, server: www.mysite.com, request: "GET /wp-content/themes/novavideo/css/horizontal.php?responsive=yes&ver=4.1.1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/page25/"
2015/06/06 14:04:49 [error] 12947#0: *19548263 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 49.248.136.243, server: www.mysite.com, request: "GET /wp-content/themes/novavideo/css/colors.php?color=00a5ae&ver=4.1.1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/page25/"
2015/06/06 14:04:49 [error] 12946#0: *19543775 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 27.4.216.210, server: www.mysite.com, request: "GET /wp-content/themes/novavideo/css/colors.php?color=00a5ae&ver=4.1.1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/page2015/"
2015/06/06 14:04:49 [error] 12945#0: *19547719 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 5.198.226.18, server: www.mysite.com, request: "GET /hindi/2015-hindi-hindi/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/"
2015/06/06 14:05:02 [error] 12948#0: *19549927 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 116.203.72.57, server: www.mysite.com, request: "GET /wp-content/themes/novavideo/css/colors.php?color=00a5ae&ver=4.1.1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/?s=PK"
2015/06/06 14:05:03 [error] 12946#0: *19549568 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 79.181.130.103, server: www.mysite.com, request: "GET /wp-content/themes/novavideo/css/horizontal.php?responsive=yes&ver=4.1.1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/page85/"
2015/06/06 14:05:03 [error] 12946#0: *19549981 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 49.205.70.77, server: www.mysite.com, request: "GET /wp-content/themes/novavideo/css/horizontal.php?responsive=yes&ver=4.1.1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/page90/"
2015/06/06 14:05:03 [error] 12948#0: *19549963 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 79.181.130.103, server: www.mysite.com, request: "GET /wp-content/themes/novavideo/css/colors.php?color=00a5ae&ver=4.1.1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/page45/"
2015/06/06 14:05:10 [error] 12945#0: *19550444 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 182.68.27.181, server: www.mysite.com, request: "GET /wp-content/themes/novavideo/css/colors.php?color=00a5ae&ver=4.1.1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/page25/"
2015/06/06 14:05:10 [error] 12948#0: *19550032 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 103.15.63.118, server: www.mysite.com, request: "GET /wp-content/themes/novavideo/css/horizontal.php?responsive=yes&ver=4.1.1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/"
2015/06/06 14:05:10 [error] 12945#0: *19550447 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 37.231.171.106, server: www.mysite.com, request: "GET /telugu/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://www.google.com.kw/"
2015/06/06 14:05:10 [error] 12948#0: *19550026 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 103.15.63.118, server: www.mysite.com, request: "GET /wp-content/themes/novavideo/css/large.php?responsive=yes&ver=4.1.1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/"
2015/06/06 14:05:10 [error] 12948#0: *19549991 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 190.33.66.70, server: www.mysite.com, request: "GET /wp-content/themes/novavideo/css/horizontal.php?responsive=yes&ver=4.1.1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/page36/"
2015/06/06 14:05:10 [error] 12948#0: *19549993 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 190.33.66.70, server: www.mysite.com, request: "GET /wp-content/themes/novavideo/css/colors.php?color=00a5ae&ver=4.1.1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/page83/"
2015/06/06 14:14:08 [error] 12946#0: *19587787 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 117.221.122.149, server: www.mysite.com, request: "GET /wp-content/themes/novavideo/css/large.php?responsive=yes&ver=4.1.1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/"
2015/06/06 14:14:08 [error] 12946#0: *19587789 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 117.221.122.149, server: www.mysite.com, request: "GET /wp-content/themes/novavideo/css/horizontal.php?responsive=yes&ver=4.1.1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/"
2015/06/06 14:14:08 [error] 12946#0: *19587788 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 117.221.122.149, server: www.mysite.com, request: "GET /wp-content/themes/novavideo/css/colors.php?color=00a5ae&ver=4.1.1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/"
2015/06/06 14:14:09 [error] 12947#0: *19587610 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 116.203.79.137, server: www.mysite.com, request: "GET /wp-content/themes/novavideo/css/horizontal.php?responsive=yes&ver=4.1.1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/page57/"
2015/06/06 14:14:10 [error] 12948#0: *19588323 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 61.246.208.190, server: www.mysite.com, request: "GET /hindi/feed/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com"
2015/06/06 14:14:10 [error] 12946#0: *19581572 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream, client: 182.186.47.172, server: www.mysite.com, request: "GET /wp-content/themes/novavideo/css/horizontal.php?responsive=yes&ver=4.1.1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/page69/"
2015/06/06 14:49:18 [error] 12948#0: *19721366 FastCGI sent in stderr: "PHP message: PHP Warning:  session_start(): The session id is too long or contains illegal characters, valid characters are a-z, A-Z, 0-9 and '-,' in /var/www/mysite.com/html/wp-content/plugins/wsecure/wsecure-authentication.php on line 15" while reading response header from upstream, client: 173.88.208.211, server: www.mysite.com, request: "GET /page69/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com"
2015/06/06 14:49:18 [error] 12948#0: *19721366 FastCGI sent in stderr: "PHP message: PHP Warning:  Unknown: The session id is too long or contains illegal characters, valid characters are a-z, A-Z, 0-9 and '-,' in Unknown on line 0
PHP mess" while reading upstream, client: 173.88.208.211, server: www.mysite.com, request: "GET /page874/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com"
2015/06/06 14:49:18 [error] 12948#0: *19721366 FastCGI sent in stderr: "age: PHP Warning:  Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/lib/php5) in Unknown on line 0" while reading upstream, client: 173.88.208.211, server: www.mysite.com, request: "GET /page89/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com"
2015/06/07 01:03:26 [error] 12948#0: *20918559 FastCGI sent in stderr: "PHP message: PHP Warning:  session_start(): The session id is too long or contains illegal characters, valid characters are a-z, A-Z, 0-9 and '-,' in /var/www/mysite.com/html/wp-content/plugins/wsecure/wsecure-authentication.php on line 15" while reading response header from upstream, client: 203.106.152.30, server: www.mysite.com, request: "GET /page27/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "https://www.google.com.my/"
2015/06/07 01:03:26 [error] 12948#0: *20918559 FastCGI sent in stderr: "PHP message: PHP Warning:  Unknown: The session id is too long or contains illegal characters, valid characters are a-z, A-Z, 0-9 and '-,' in Unknown on line 0
PHP message: PHP Warning:  Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/lib/php5) in Unknown on line 0" while reading upstream, client: 203.106.152.30, server: www.mysite.com, request: "GET /page47/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "https://www.google.com.my/"
2015/06/07 01:23:38 [error] 12946#0: *20971048 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 178.63.13.15, server: www.mysite.com, request: "GET /genre/page/15/?display=extract&filtre=date HTTP/1.0", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com"
2015/06/07 01:23:38 [error] 12946#0: *20969415 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 221.154.17.6, server: www.mysite.com, request: "GET /malayalam/page/2/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/english/"
2015/06/07 01:23:39 [crit] 12946#0: *20970895 connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 108.184.27.146, server: www.mysite.com, request: "GET /dil-dhadakne-2015-full-movie-online-watch-hindi-full-length-film/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/hindi/"
2015/06/07 01:24:07 [error] 12945#0: *20970770 directory index of "/var/www/mysite.com/html/wp-content/uploads/2015/02/" is forbidden, client: 178.152.60.151, server: www.mysite.com, request: "GET /wp-content/uploads/2015/02/ HTTP/1.1", host: "mysite.com", referrer: "http://mysite.com/wp-content/uploads/2015/02/official-1233.jpg"

MY Virtual Host File is:

server {
        listen 80;
        listen [::]:80;

        root /var/www/mysite.com/html;
        index index.php index.html index.htm;

        # Make site accessible from http://localhost/
        server_name www.mysite.com mysite.com;

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ /index.php?q=$request_uri;
                # Uncomment to enable naxsi on this location
                # include /etc/nginx/naxsi.rules
        }
        error_page 404 /404.html;
        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
                root /usr/share/nginx/html;
        }

        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                fastcgi_index index.php;
                include fastcgi_params;
        }

        # Only for nginx-naxsi used with nginx-naxsi-ui : process denied requests
        #location /RequestDenied {
        #       proxy_pass http://127.0.0.1:8080;
        #}

        #error_page 404 /404.html;
        # redirect server error pages to the static page /50x.html
        #
        #error_page 500 502 503 504 /50x.html;
        #location = /50x.html {
        #       root /usr/share/nginx/html;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ \.php$ {
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
        #       # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
        #
        #       # With php5-cgi alone:
        #       fastcgi_pass 127.0.0.1:9000;
        #       # With php5-fpm:
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;
        }
        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #       deny all;
        #}
}


# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
#       listen 8000;
#       listen somename:8080;
#       server_name somename alias another.alias;
#       root html;
#       index index.html index.htm;
#
#       location / {
#               try_files $uri $uri/ =404;
#       }
#}


# HTTPS server
#
#server {
#       listen 443;
#       server_name localhost;
#
#       root html;
#       index index.html index.htm;
#
#       ssl on;
#       ssl_certificate cert.pem;
#       ssl_certificate_key cert.key;
#
#       ssl_session_timeout 5m;
#       ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
#       ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES";
#       ssl_prefer_server_ciphers on;
#
#       location / {
#               try_files $uri $uri/ =404;
#       }
#}

and my Nginx Config file is:

user www-data;
worker_processes 4;
pid /run/nginx.pid;

events {
        worker_connections 1024;
        multi_accept on;
}

http {

        ##
        # Basic Settings
        ##
        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 65;
        keepalive_requests 100000;

        client_body_buffer_size 10K;
        client_header_buffer_size 1k;
        client_max_body_size 8m;
        large_client_header_buffers  4 32k;
        client_body_timeout 12;
        client_header_timeout 12;
        send_timeout 10;

        types_hash_max_size 2048;
        # server_tokens off;
        server_names_hash_bucket_size 64;
        # server_name_in_redirect off;

        include /etc/nginx/mime.types;
        default_type application/octet-stream;

        ##
        # Logging Settings
        ##

        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;

        ##
        # Gzip Settings
        ##

        gzip on;
        gzip_static on;
        gzip_disable "msie6";

        # gzip_vary on;
        # gzip_proxied any;
        # gzip_comp_level 6;
        # gzip_buffers 16 8k;
        # gzip_http_version 1.1;
        # gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

        ##
        # nginx-naxsi config
        ##
        # Uncomment it if you installed nginx-naxsi
        ##

        #include /etc/nginx/naxsi_core.rules;

        ##
        # nginx-passenger config
        ##
        # Uncomment it if you installed nginx-passenger
        ##

        #passenger_root /usr;
        #passenger_ruby /usr/bin/ruby;

        ##
        # Virtual Host Configs
        ##
        include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*;
}


#mail {
#       # See sample authentication script at:
#       # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
#       # auth_http localhost/auth.php;
#       # pop3_capabilities "TOP" "USER";
#       # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
#       server {
#               listen     localhost:110;
#               protocol   pop3;
#               proxy      on;
#       }
#
#       server {
#               listen     localhost:143;
#               protocol   imap;
#               proxy      on;
#       }
#}

My fastcgi_param File is:

fastcgi_param   QUERY_STRING            $query_string;
fastcgi_param   REQUEST_METHOD          $request_method;
fastcgi_param   CONTENT_TYPE            $content_type;
fastcgi_param   CONTENT_LENGTH          $content_length;

fastcgi_param   SCRIPT_FILENAME         $request_filename;
fastcgi_param   SCRIPT_NAME             $fastcgi_script_name;
fastcgi_param   REQUEST_URI             $request_uri;
fastcgi_param   DOCUMENT_URI            $document_uri;
fastcgi_param   DOCUMENT_ROOT           $document_root;
fastcgi_param   SERVER_PROTOCOL         $server_protocol;

fastcgi_param   GATEWAY_INTERFACE       CGI/1.1;
fastcgi_param   SERVER_SOFTWARE         nginx/$nginx_version;

fastcgi_param   REMOTE_ADDR             $remote_addr;
fastcgi_param   REMOTE_PORT             $remote_port;
fastcgi_param   SERVER_ADDR             $server_addr;
fastcgi_param   SERVER_PORT             $server_port;
fastcgi_param   SERVER_NAME             $server_name;

fastcgi_param   HTTPS                   $https if_not_empty;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param   REDIRECT_STATUS         200;

I'm a newbie to Nginx and I asked several time this problem to support and they were unable to find out a solution for this.

I have two problem with my this site.

1) I want to rid of from my the aforesaid errors. How can I solve this issue?

2) I want to open my site as "www.mysite.com", now its opening as http://mysite.com instead of http://www.mysite.com. Domain AAA records are correct. I think there is a bad config in my ngnix.conf. Plz suggest me the correct configuration for this.

3) I think my Nginx.conf file is not optimized in a better way. I'm getting around 10k- 15k traffic each day. some time my site is opening very slowly. How can I speed up my site?

Thanks in Advance for your valuable suggestion.

NB: Sorry for the Bad English. Its not my native Language.

2 comments
  • @eldin please help me to fix "upstream: "fastcgi://unix:/var/run/php5-fpm.sock". Pplease email me kusnendarebid(at)gmail(.)com. thanks

  • Hi DO Team

    I am facing the same issue thatconnect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upstream.90% of my error log file is due to this error.I want to fix this.Kindly help.
    Mail ID:- rishipdp@gmail.com

15 Answers

Welcome to DigitalOcean.

If you can´t understand English well, I could do it for you. Just ask and I provide my email address. If you don´t want that I could post a tutorial for you.

Just reply what you want

@bijuoosmail sorry for the delay.

Backup your old Configuration
```sudo cp -r /etc/nginx /etc/nginxold
sudo cp -r /etc/php5 /etc/pgp5
old

Remove your old Nginx and PHP5 installation
```sudo purge nginx php5-fpm

Reinstall Nginx and PHP

```sudo apt-get install nginx php5-fpm

Now we are going to configure Nginx and PHP right

```rm -r  /etc/nginx/sites-available/default
touch /etc/nginx/sites-available/default
nano /etc/nginx/sites-available/default

Paste this (right click) edit root and server name. Save it (CTRL X)

##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##

# Default server configuration
#
server {
    listen 80 default_server;
    listen [::]:80 default_server;

    root /var/www/html;

    # Add index.php to the list if you are using PHP
    index index.html index.php index.htm;

    server_name your_domain;

    location / {
        # First attempt to serve request as file, then
        # as directory, then fall back to displaying a 404.
        try_files $uri $uri/ =404;
        autoindex on;
    }

    location ~ \.php$ {
            try_files $uri =404;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass unix:/var/run/php5-fpm.sock;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include fastcgi_params;
        }

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #   deny all;
    #}
}

# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
#   listen 80;
#   listen [::]:80;
#
#   server_name example.com;
#
#   root /var/www/example.com;
#   index index.html;
#
#   location / {
#       try_files $uri $uri/ =404;
#   }
#}

Restart your Server service nginx restart

PS: If it works, please show me some love and click the hearth

  • @eldin Thanks a lot for your help.

    Its worked awesome!

    Could you please advise me for my 2 & 3 problem too?

    1) I want to open my site as "http://www.mysite.com" instead of "http://mysite.com" (Now its opening as http://mysite.com, without "WWW.").

    2) How can I speed up my site? Its opening very slowly now. Could you please have a look on my nginx.conf file?

    I doubt in the following settings:

    workerprocesses 4;
    worker
    connections 1024;
    keepalivetimeout 65;
    keepalive
    requests 100000;
    send_timeout 10; etc....

    is it the correct configuration for 8GB RAM/80GB/4 Core CPU virtual box? Plz plz suggest me the correct configuration.

    3) I purchased Ubermenu(Javascript & CSS Supported menu) for my site and done few changes, but Changes not being reflected on the front end. How can I clear the server cache entirely to have it re-cache the site with the new menu items?

    it would be greatly appreciated, if you help me in these things too.

    Thanks in advance!

    NB: I'm using Ubuntu

  • @eldin
    Still I'm getting the following errors:

    2015/06/10 01:57:22 [error] 9248#0: *179924 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: 121.54.44.95, server: www.mysite.com, request: "GET /hindi/2015-music/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/2-page-now-full-check-page-full-length-mp3/"
    2015/06/10 01:57:22 [error] 9249#0: *186459 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: 124.123.38.116, server: www.mysite.com, request: "GET /?s=safeheaven HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/?s=the+last+song"
    2015/06/10 01:57:22 [error] 9249#0: *186461 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: 183.82.70.208, server: www.mysite.com, request: "GET /pandaga-chesko-2015-full-service-now-check-page3-full-length-mp3-jagpati-babu/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com"
    2015/06/10 01:57:22 [error] 9249#0: *186443 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: 117.206.228.144, server: www.mysite.com, request: "GET /page3/2015-page3/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "https://www.google.co.in/"
    2015/06/10 01:57:23 [error] 9249#0: *186466 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: 124.123.38.116, server: www.mysite.com, request: "GET /?s=safeheaven HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/?s=the+last+song"
    2015/06/10 01:57:23 [error] 9248#0: *180119 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: 178.152.73.200, server: www.mysite.com, request: "GET /page5/page/4/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host:"mysite.com", referrer: "http://mysite.com/page5/page/3/"
    2015/06/10 01:57:23 [error] 9246#0: *182705 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: 117.204.20.8, server: www.mysite.com, request: "GET /wp-content/themes/novavideo/css/large.php?responsive=yes&ver=4.1.1 HTTP/1.1", upstream:"fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/london-bridge-2014-service-now-full-check-page5-full-length-mp3/"
    2015/06/10 01:57:23 [error] 9249#0: *186479 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: 124.123.38.116, server: www.mysite.com, request: "GET /?s=safeheaven HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/?s=the+last+song"
    2015/06/10 01:57:23 [error] 9249#0: *186443 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: 117.206.228.144, server: www.mysite.com, request: "GET /favicn.ico HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/page3/2015-page3/"
    2015/06/10 01:57:23 [error] 9248#0: *180119 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: 178.152.73.200, server: www.mysite.com, request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/page5/page/4/"
    2015/06/10 01:57:23 [error] 9249#0: *186494 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: 124.123.38.116, server: www.mysite.com, request: "GET /?s=safeheaven HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/?s=the+last+song"
    2015/06/10 01:57:23 [error] 9249#0: *182735 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: 117.204.20.8, server: www.mysite.com, request: "GET /wp-content/themes/novavideo/css/colors.php?color=00a5ae&ver=4.1.1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer:"http://mysite.com/london-bridge-2014-service-now-full-check-page5-full-length-mp3/"
    2015/06/10 01:57:23 [error] 9249#0: *184986 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: 122.168.213.82, server: www.mysite.com, request: "GET /wp-content/themes/novavideo/css/horizontal.php?responsive=yes&ver=4.1.1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/page/"
    2015/06/10 01:57:23 [error] 9249#0: *186508 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: 203.106.151.219, server: www.mysite.com, request: "GET /page/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "https://www.google.com.my/"
    2015/06/10 01:57:23 [error] 9247#0: *185641 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: 122.168.213.82, server: www.mysite.com, request: "GET /wp-content/themes/novavideo/css/colors.php?color=00a5ae&ver=4.1.1 HTTP/1.1", upstream:"fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/page/"
    2015/06/10 01:57:23 [error] 9249#0: *186512 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: 124.123.38.116, server: www.mysite.com, request: "GET /?s=safeheaven HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/?s=the+last+song"
    2015/06/10 01:57:23 [error] 9249#0: *182576 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: 202.63.101.253, server: www.mysite.com, request: "GET /singham-123-2015-full-service-now-check-page3-full-length-mp3/ HTTP/1.1", upstream:"fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com"
    2015/06/10 01:57:23 [error] 9249#0: *186518 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: 52.1.109.240, server: www.mysite.com, request: "GET /page/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://www.mysite.com/page/"
    2015/06/10 01:57:23 [error] 9249#0: *186521 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: 37.140.141.9, server: www.mysite.com, request: "GET /birdman-2014-full-service-check-now-page2-full-length-mp3-2014/ HTTP/1.1", upstream:"fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com"
    2015/06/10 01:57:23 [error] 9249#0: *186529 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: 157.55.39.213, server: www.mysite.com, request: "GET /?s=the%20duff&filtre=views&display=wall HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com"
    2015/06/10 01:57:23 [error] 9249#0: *186531 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: 124.123.38.116, server: www.mysite.com, request: "GET /?s=safeheaven HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/?s=the+last+song"
    2015/06/10 01:57:23 [error] 9249#0: *186534 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: 124.123.38.116, server: www.mysite.com, request: "GET /?s=safeheaven HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/?s=the+last+song"
    2015/06/10 01:57:23 [error] 9249#0: *186508 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: 203.106.151.219, server: www.mysite.com, request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/page/"
    2015/06/10 01:57:24 [error] 9247#0: *185644 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: 122.168.213.82, server: www.mysite.com, request: "GET /wp-content/themes/novavideo/css/large.php?responsive=yes&ver=4.1.1 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/page/"
    2015/06/10 01:57:24 [error] 9249#0: *186540 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: 124.123.38.116, server: www.mysite.com, request: "GET /?s=safeheaven HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/?s=the+last+song"
    2015/06/10 01:57:24 [error] 9247#0: *185600 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: 49.205.240.40, server: www.mysite.com, request: "GET /page3/HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "https://www.google.co.in/"
    2015/06/10 01:57:24 [error] 9249#0: *186541 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: 124.123.38.116, server: www.mysite.com, request: "GET /?s=safeheaven HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/?s=the+last+song"
    2015/06/10 01:57:24 [error] 9247#0: *186562 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: 124.123.38.116, server: www.mysite.com, request: "GET /?s=safeheaven HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/?s=the+last+song"
    2015/06/10 01:57:24 [error] 9247#0: *186566 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: 124.123.38.116, server: www.mysite.com, request: "GET /?s=safeheaven HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/?s=the+last+song"
    2015/06/10 01:57:24 [error] 9247#0: *186573 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: 117.205.46.229, server: www.mysite.com, request: "GET /page2/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=3&sqi=2&ved=0CCcQjBAwAmoVChMIucmk4riExgIVw7m8Ch1TtgAY&url=http%3A%2F%2Fmysite.com%2Fenglish%2F&ei=wNF3VbnpBMPz8gXT7ILAAQ&usg=AFQjCNFAlNbj_7xh06rnx6DH0720iLJBtg&bvm=bv.95039771,d.dGc"
    2015/06/10 01:57:24 [error] 9247#0: *186572 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: 124.123.38.116, server: www.mysite.com, request: "GET /?s=safeheaven HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/?s=the+last+song"
    2015/06/10 01:57:24 [error] 9247#0: *186579 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: 112.134.92.82, server: www.mysite.com, request: "GET /fast-furious-7-2015-full-service-now-check-page2-full-length-mp3-hollywood-service/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://www.google.lk/search?q=fast+and+furious+7+full+service&hl=en-LK&gbv=2&oq=fast&gs_l=heirloom-serp.1.1.0l10.98653.108908.0.112925.16.10.0.0.0.2.231.980.3j2j2.7.0....0...1ac.1.34.heirloom-serp..12.4.663.sSbBMTs54vE"
    2015/06/10 01:57:24 [error] 9247#0: *186598 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: 124.123.38.116, server: www.mysite.com, request: "GET /?s=safeheaven HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/?s=the+last+song"
    2015/06/10 01:57:24 [error] 9246#0: *182186 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: 112.133.192.188, server: www.mysite.com, request: "GET /page5/2015-page5/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/"
    2015/06/10 01:57:24 [error] 9247#0: *186579 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: 112.134.92.82, server: www.mysite.com, request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com"
    2015/06/10 01:57:24 [error] 9247#0: *186603 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: 108.171.128.189, server: www.mysite.com, request: "GET /peekay-full-service-check-now-page-full-length-mp3-2014-aamir-khan-anushka-sharma-sushant-singh-rajput/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com"
    2015/06/10 03:20:12 [error] 9246#0: *395723 FastCGI sent in stderr: "PHP message: PHP Warning:  session_start(): The session id is too long or contains illegal characters, valid characters are a-z, A-Z, 0-9 and '-,' in /var/www/mysite.com/html/wp-content/plugins/wsecure/wsecure-authentication.php on line 15" while reading response header from upstream, client: 67.166.145.87, server: www.mysite.com, request: "GET /temper-2015-full-service-check-now-page3-full-length-mp3-jr-ntr-kajal-aggarwal/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "https://www.google.com/"
    2015/06/10 03:20:12 [error] 9246#0: *395723 FastCGI sent in stderr: "PHP message: PHP Warning:  Unknown: The session id is too long or contains illegal characters, valid characters are a-z, A-Z, 0-9 and '-,' in Unknown on line 0
    PHP message: PHP Warning:  Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/lib/php5) in Unknown on line 0" while reading upstream, client: 67.166.145.87, server: www.mysite.com, request: "GET /temper-2015-full-service-check-now-page3-full-length-mp3-jr-ntr-kajal-aggarwal/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "https://www.google.com/"
    2015/06/10 03:22:13 [error] 9249#0: *401331 FastCGI sent in stderr: "PHP message: PHP Warning:  session_start(): The session id is too long or contains illegal characters, valid characters are a-z, A-Z, 0-9 and '-,' in /var/www/mysite.com/html/wp-content/plugins/wsecure/wsecure-authentication.php on line 15" while reading response header from upstream, client: 67.166.145.87, server: www.mysite.com, request: "GET /dohchay-2015-full-service-now-check-page3-full-length-mp3-naga-chaitanya/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "https://www.google.com/"
    2015/06/10 03:22:14 [error] 9249#0: *401331 FastCGI sent in stderr: "PHP message: PHP Warning:  Unknown: The session id is too long or contains illegal characters, valid characters are a-z, A-Z, 0-9 and '-,' in Unknown on line 0
    PHP message: PHP Warning:  Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/lib/php5) in Unknown on line 0" while reading upstream, client: 67.166.145.87, server: www.mysite.com, request: "GET /dohchay-2015-full-service-now-check-page3-full-length-mp3-naga-chaitanya/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "https://www.google.com/"
    2015/06/10 03:22:33 [error] 9249#0: *401336 FastCGI sent in stderr: "PHP message: PHP Warning:  session_start(): The session id is too long or contains illegal characters, valid characters are a-z, A-Z, 0-9 and '-,' in /var/www/mysite.com/html/wp-content/plugins/wsecure/wsecure-authentication.php on line 15" while reading response header from upstream, client: 67.166.145.87, server: www.mysite.com, request: "GET /jil-page3-2015-full-service-now/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "https://www.google.com/"
    2015/06/10 03:22:33 [error] 9249#0: *401336 FastCGI sent in stderr: "PHP message: PHP Warning:  Unknown: The session id is too long or contains illegal characters, valid characters are a-z, A-Z, 0-9 and '-,' in Unknown on line 0
    PHP message: PHP Warning:  Unknown: Failed to write sess" while reading upstream, client: 67.166.145.87, server: www.mysite.com, request: "GET /jil-page3-2015-full-service-now/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "https://www.google.com/"
    2015/06/10 03:22:33 [error] 9249#0: *401336 FastCGI sent in stderr: "ion data (files). Please verify that the current setting of session.save_path is correct (/var/lib/php5) in Unknown on line 0" while reading upstream, client: 67.166.145.87, server: www.mysite.com, request: "GET /jil-page3-2015-full-service-now/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "https://www.google.com/"
    2015/06/10 03:23:37 [error] 9247#0: *405093 FastCGI sent in stderr: "PHP message: PHP Warning:  session_start(): The session id is too long or contains illegal characters, valid characters are a-z, A-Z, 0-9 and '-,' in /var/www/mysite.com/html/wp-content/plugins/wsecure/wsecure-authentication.php on line 15" while reading response header from upstream, client: 49.204.147.143, server: www.mysite.com, request: "GET /jil-page3-2015-full-service-now/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com"
    2015/06/10 03:23:37 [error] 9247#0: *405093 FastCGI sent in stderr: "PHP message: PHP Warning:  Unknown: The session id is too long or contains illegal characters, valid characters are a-z, A-Z, 0-9 and '-,' in Unknown on line 0
    PHP message: PHP Warning:  Unknown: Failed to write sess" while reading upstream, client: 49.204.147.143, server: www.mysite.com, request: "GET /jil-page3-2015-full-service-now/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com"
    2015/06/10 03:23:37 [error] 9247#0: *405093 FastCGI sent in stderr: "ion data (files). Please verify that the current setting of session.save_path is correct (/var/lib/php5) in Unknown on line 0" while reading upstream, client: 49.204.147.143, server: www.mysite.com, request: "GET /jil-page3-2015-full-service-now/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com"
    
    

@bijuoosmail

*Question 2:*

nano /etc/nginx/nginx.conf

Edit this for a faster nginx

worker_processes  4;

events {
    worker_connections  8096;
    multi_accept        on;
    use                 epoll;
}

*Question 1:*

To use www.domain.com you need to change your DNS, add a A Record with name www

Now we need to configure Nginx nano /etc/nginx/sites-available/default

 server_name your_domain www.your_domain;

Don´t forget to restart nginx service nginx restart

*Question 3:*
How about you remove your Browser Cache ? This works most of the time

  • @eldin thanks for the reply.

    Could you please send me your email id to : bijuoosmail [at] gmail dot com?

    Still I'm getting these errors:

    5/06/10 01:57:24 [error] 9249#0: *186540 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: 124.123.38.116, server: www.mysite.com, request: "GET /?s=safeheaven HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/?s=the+last+song"
    2015/06/10 01:57:24 [error] 9247#0: *185600 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: 49.205.240.40, server: www.mysite.com, request: "GET /page3/HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "https://www.google.co.in/"
    2015/06/10 01:57:24 [error] 9249#0: *186541 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: 124.123.38.116, server: www.mysite.com, request: "GET /?s=safeheaven HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/?s=the+last+song"
    2015/06/10 01:57:24 [error] 9247#0: *186562 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: 124.123.38.116, server: www.mysite.com, request: "GET /?s=safeheaven HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/?s=the+last+song"
    2015/06/10 01:57:24 [error] 9247#0: *186566 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: 124.123.38.116, server: www.mysite.com, request: "GET /?s=safeheaven HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/?s=the+last+song"
    2015/06/10 01:57:24 [error] 9247#0: *186573 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: 117.205.46.229, server: www.mysite.com, request: "GET /page2/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=3&sqi=2&ved=0CCcQjBAwAmoVChMIucmk4riExgIVw7m8Ch1TtgAY&url=http%3A%2F%2Fmysite.com%2Fenglish%2F&ei=wNF3VbnpBMPz8gXT7ILAAQ&usg=AFQjCNFAlNbj_7xh06rnx6DH0720iLJBtg&bvm=bv.95039771,d.dGc"
    2015/06/10 01:57:24 [error] 9247#0: *186572 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: 124.123.38.116, server: www.mysite.com, request: "GET /?s=safeheaven HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/?s=the+last+song"
    2015/06/10 01:57:24 [error] 9247#0: *186579 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: 112.134.92.82, server: www.mysite.com, request: "GET /fast-furious-7-2015-full-service-now-check-page2-full-length-mp3-hollywood-service/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://www.google.lk/search?q=fast+and+furious+7+full+service&hl=en-LK&gbv=2&oq=fast&gs_l=heirloom-serp.1.1.0l10.98653.108908.0.112925.16.10.0.0.0.2.231.980.3j2j2.7.0....0...1ac.1.34.heirloom-serp..12.4.663.sSbBMTs54vE"
    2015/06/10 01:57:24 [error] 9247#0: *186598 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: 124.123.38.116, server: www.mysite.com, request: "GET /?s=safeheaven HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/?s=the+last+song"
    2015/06/10 01:57:24 [error] 9246#0: *182186 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: 112.133.192.188, server: www.mysite.com, request: "GET /page5/2015-page5/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "http://mysite.com/"
    2015/06/10 01:57:24 [error] 9247#0: *186579 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: 112.134.92.82, server: www.mysite.com, request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com"
    2015/06/10 01:57:24 [error] 9247#0: *186603 connect() to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,client: 108.171.128.189, server: www.mysite.com, request: "GET /peekay-full-service-check-now-page-full-length-mp3-2014-aamir-khan-anushka-sharma-sushant-singh-rajput/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com"
    2015/06/10 03:20:12 [error] 9246#0: *395723 FastCGI sent in stderr: "PHP message: PHP Warning:  session_start(): The session id is too long or contains illegal characters, valid characters are a-z, A-Z, 0-9 and '-,' in /var/www/mysite.com/html/wp-content/plugins/wsecure/wsecure-authentication.php on line 15" while reading response header from upstream, client: 67.166.145.87, server: www.mysite.com, request: "GET /temper-2015-full-service-check-now-page3-full-length-mp3-jr-ntr-kajal-aggarwal/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "https://www.google.com/"
    2015/06/10 03:20:12 [error] 9246#0: *395723 FastCGI sent in stderr: "PHP message: PHP Warning:  Unknown: The session id is too long or contains illegal characters, valid characters are a-z, A-Z, 0-9 and '-,' in Unknown on line 0
    PHP message: PHP Warning:  Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/lib/php5) in Unknown on line 0" while reading upstream, client: 67.166.145.87, server: www.mysite.com, request: "GET /temper-2015-full-service-check-now-page3-full-length-mp3-jr-ntr-kajal-aggarwal/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "https://www.google.com/"
    2015/06/10 03:22:13 [error] 9249#0: *401331 FastCGI sent in stderr: "PHP message: PHP Warning:  session_start(): The session id is too long or contains illegal characters, valid characters are a-z, A-Z, 0-9 and '-,' in /var/www/mysite.com/html/wp-content/plugins/wsecure/wsecure-authentication.php on line 15" while reading response header from upstream, client: 67.166.145.87, server: www.mysite.com, request: "GET /dohchay-2015-full-service-now-check-page3-full-length-mp3-naga-chaitanya/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "https://www.google.com/"
    PHP message: PHP Warning:  Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/lib/php5) in Unknown on line 0" while reading upstream, client: 67.166.145.87, server: www.mysite.com, request: "GET /dohchay-2015-full-service-now-check-page3-full-length-mp3-naga-chaitanya/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "https://www.google.com/"
    2015/06/10 03:22:33 [error] 9249#0: *401336 FastCGI sent in stderr: "PHP message: PHP Warning:  session_start(): The session id is too long or contains illegal characters, valid characters are a-z, A-Z, 0-9 and '-,' in /var/www/mysite.com/html/wp-content/plugins/wsecure/wsecure-authentication.php on line 15" while reading response header from upstream, client: 67.166.145.87, server: www.mysite.com, request: "GET /jil-page3-2015-full-service-now/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "https://www.google.com/"
    2015/06/10 03:22:33 [error] 9249#0: *401336 FastCGI sent in stderr: "PHP message: PHP Warning:  Unknown: The session id is too long or contains illegal characters, valid characters are a-z, A-Z, 0-9 and '-,' in Unknown on line 0
    PHP message: PHP Warning:  Unknown: Failed to write sess" while reading upstream, client: 67.166.145.87, server: www.mysite.com, request: "GET /jil-page3-2015-full-service-now/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "https://www.google.com/"
    2015/06/10 03:22:33 [error] 9249#0: *401336 FastCGI sent in stderr: "ion data (files). Please verify that the current setting of session.save_path is correct (/var/lib/php5) in Unknown on line 0" while reading upstream, client: 67.166.145.87, server: www.mysite.com, request: "GET /jil-page3-2015-full-service-now/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com", referrer: "https://www.google.com/"
    PHP message: PHP Warning:  Unknown: Failed to write sess" while reading upstream, client: 49.204.147.143, server: www.mysite.com, request: "GET /jil-page3-2015-full-service-now/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com"
    2015/06/10 03:23:37 [error] 9247#0: *405093 FastCGI sent in stderr: "ion data (files). Please verify that the current setting of session.save_path is correct (/var/lib/php5) in Unknown on line 0" while reading upstream, client: 49.204.147.143, server: www.mysite.com, request: "GET /jil-page3-2015-full-service-now/ HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mysite.com"
    

    I changed in my virtual host file : server_name mysite.com www.mysite.com;, but still its opening as http://mysite.com (My domain A records are correct).

    regarding cache: Its not browser cache. Server is not showing my changes.

    Could you please contact me through my email. I'll give you more details.

    Thanks for your help.

    edited by asb

@eldin Thanks for the reply! I can understand English. Problem with my English writing. Thanks

@eldin I got the mail. Thanks.

My problem is still exists and couldn't find the root cause.

Result of the following commands:

ls -l /var/run/php5-fpm.sock:
srw-rw---- 1 www-data www-data 0 Jun 9 12:55 /var/run/php5-fpm.sock

grep 'user' /etc/nginx/nginx.conf:
user www-data;

/etc/php5/fpm/pool.d/www.conf: (removed ; from the following)

listen.owner = www-data
listen.group = www-data
listen.mode = 0660

Anyone here to help me out?

  • Yes, I am still here to help. I would create a Tutorial, you just need to wait a bit. I also explained the root of your problem at my latest mail.

@eldin You are really awesome.. But still the problem exists. I just sent you the details now.

hi eldin, any updates? thanks!

I'm also getting a lot of the following errors:

connect() to unix:/var/run/php5-fpm.sock failed

Any solution?
Thanks!

  • I was having the same problem yesterday and this seems to work...

    No outages until now :)

    I really hope it helps all of you!

@eldin please help me to fix "upstream: "fastcgi://unix:/var/run/php5-fpm.sock". Pplease email me kusnendarebid(at)gmail(.)com. thanks

Hello @bijuoos @oriolcaldero @joannalee0910 @akehat @kusnendarwebid5,

OMG I totally forgot answer this question, sorry.

Here you go:

Before you start Snapshoot your Droplet

Paste this (at the end of the file) to /etc/sysctl.conf (using nano /etc/sysctl.conf) and save it (this change not only fixes your error it makes your System much better),

### IMPROVE SYSTEM MEMORY MANAGEMENT ###

# Increase size of file handles and inode cache
fs.file-max = 2097152

# Do less swapping
vm.swappiness = 10
vm.dirty_ratio = 60
vm.dirty_background_ratio = 2

### GENERAL NETWORK SECURITY OPTIONS ###

# Number of times SYNACKs for passive TCP connection.
net.ipv4.tcp_synack_retries = 2

# Allowed local port range
net.ipv4.ip_local_port_range = 2000 65535

# Protect Against TCP Time-Wait
net.ipv4.tcp_rfc1337 = 1

# Decrease the time default value for tcp_fin_timeout connection
net.ipv4.tcp_fin_timeout = 15

# Decrease the time default value for connections to keep alive
net.ipv4.tcp_keepalive_time = 300
net.ipv4.tcp_keepalive_probes = 5
net.ipv4.tcp_keepalive_intvl = 15

### TUNING NETWORK PERFORMANCE ###

# Default Socket Receive Buffer
net.core.rmem_default = 31457280

# Maximum Socket Receive Buffer
net.core.rmem_max = 12582912

# Default Socket Send Buffer
net.core.wmem_default = 31457280

# Maximum Socket Send Buffer
net.core.wmem_max = 12582912

# Increase number of incoming connections
net.core.somaxconn = 65535

# Increase number of incoming connections backlog
net.core.netdev_max_backlog = 65535

# Increase the maximum amount of option memory buffers
net.core.optmem_max = 25165824

# Increase the maximum total buffer-space allocatable
# This is measured in units of pages (4096 bytes)
net.ipv4.tcp_mem = 65535 131072 262144
net.ipv4.udp_mem = 65535 131072 262144

# Increase the read-buffer space allocatable
net.ipv4.tcp_rmem = 8192 87380 16777216
net.ipv4.udp_rmem_min = 16384

# Increase the write-buffer-space allocatable
net.ipv4.tcp_wmem = 8192 65535 16777216
net.ipv4.udp_wmem_min = 16384

# Increase the tcp-time-wait buckets pool size to prevent simple DOS attacks
net.ipv4.tcp_max_tw_buckets = 1440000
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1

Paste this (at the end of the file) to /etc/security/limits.conf (using nano /etc/security/limits.conf) and save it,

nginx           soft    nofile          2097152
nginx           hard    nofile          2097152
www-data        soft    nofile          2097152
www-data        hard    nofile          2097152

Paste this (at the end of the file) to /etc/pam.d/common-session (using nano /etc/pam.d/common-session) and save it,

session required pam_limits.so

Change listen.backlog in /etc/php5/fpm/pool.d/www.conf (using nano /etc/php5/fpm/pool.d/www.conf) and save it,

listen.backlog = 65535

Change workerrlimitnofile in /etc/nginx/nginx.conf (using nano /etc/nginx/nginx.conf) and save it,

worker_rlimit_nofile 99999;

And finally reboot :-)

  • Hello eldin,

    I have the same issue as the others here.

    I have an ajax long polling script on my page: So one server side php script is running continuously for about 20 seconds (with 1 sec sleep and then mysql DB poll).

    As a very simple test I fired up 10 to 20 browser tabs loading the same ajax script.
    I get timeout and the errors above. I am the only one accessing the site.

    I am totally new to linux, web server etc. What I have trouble understanding is: Why don't this work out of the box when following the guidelines on your site for installing LEMP (or any setup regardless)? And what is the reason for the errors above?

    I have tried all various solutions by googling, none have worked yet. I am about to try your last post solution now.

    However, the setup you have written above, I assume is related to a specific amount of available HW RAM? If so, could you state a formula (where applicable) for each line giving the correct statements as a function of available physical RAM?

    Thank you.

  • @eldin : workerrlimitnofile 99999;does not exist in /etc/nginx/nginx.conf

Hello @eldin

I have read the thread and others too. somehow I mixed it up I suppose and can't make it work again.

I am receiving bunch of these;

2016/04/13 16:53:44 [crit] 916#0: *530 connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 185.103.252.172, server: ozgurahsap.com, request: "POST /xmlrpc.php HTTP/1.0", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "95.85.34.33"

Could you help me out?

  • Hello @liger @eldin here,

    Could you contact me over elcore at tutanota dot com?

    This should work too (fast, easy, [the hard method]):

    https://www.digitalocean.com/community/questions/getting-nginx-fpm-sock-error?answer=22952

    STEP 1

    sudo cp -r /etc/php5 /etc/php5_old
    sudo purge php5-fpm
    sudo apt-get install php5-fpm
    

    STEP 2

    sudo service nginx restart

  • Hi @liger @bijuoos @oriolcaldero @joannalee0910 @akehat @kusnendarwebid5 @eldin @elcore

    Having dealt with the same issue over the past few days, here's what I've done to resolve it. One thing to note, if you look at the client IP on the error, you'll notice the same range of IPs over and over again... for example, in my issue, it was 185.103.252.172, 185.106.92.55, 185.130.4.197 - about 99.9% of the time.

    I would strongly recommend you do two things:

    1. Write the following into your /etc/nginx/sites-available/ file (default or whatever filename you're using if you have configured server blocks)

      # Block xmlrpc.php access
          location = /xmlrpc.php {
                  deny all;
                  }
      

      When you're done, don't forget to restart nginx

      sudo service nginx restart
      

      Source

    2. Look at the following guides to harden your configuration:

    3. Fail2ban

    4. Securing Wordpress on Nginx

    Having implemented these, I can now see these same IP addresses sitting in the error file as follows:

    [error] 1221#0: *655 access forbidden by rule, client: 185.103.252.172, server: mydomain.com, request: "POST /xmlrpc.php HTTP/1.0", host: "xxx.xxx.xxx.xxx"
    2016/04/16 07:55:18 [error] 1221#0: *656 access forbidden by rule, client: 185.106.92.55, server: mydomain.com, request: "POST /xmlrpc.php HTTP/1.0", host: "xxx.xxx.xxx.xxx"
    2016/04/16 07:55:50 [error] 1221#0: *657 access forbidden by rule, client: 185.130.4.197, server: mydomain.com, request: "POST /xmlrpc.php HTTP/1.0", host: "xxx.xxx.xxx.xxx"

    Hope this will work for you.

    Let me know via comments

    Thanks... and good luck!

    When operating a web server, it is important to implement security measures to protect your site and users. Protecting your web sites and applications with firewall policies and restricting access to certain areas with password authentication is a great starting point to...

This solved my problem:
service php5-fpm restart

Have another answer? Share your knowledge.