Hello,
I have an Ubuntu 12.04, Nginx 1.4.4, PHP 5.5.9, running Wordpress, running on an 8GB, 60GB droplet.
The site works great, some of the time, but we are experiencing intermittent 502 and 404 errors, and don’t know where to look. Here is my nginx configuration:
` server { listen 80; root /usr/share/nginx/www; index index.php; server_name website.com www.website.com; autoindex off; include conf.sites/wordpress-both.conf; access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log error;
set $cache_uri $request_uri;
if ($request_method = POST) { set $cache_uri ‘null cache’; } if ($query_string != “”) { set $cache_uri ‘null cache’; }
if ($request_uri ~* "(/wp-admin/|/xmlrpc.php|/wp-(app|cron|login|register|mail).php|wp-.*.php|/feed/|index.php|wp-comments-popup.php|wp-links-opml.php|wp-loca$ set $cache_uri ‘null cache’; }
if ($http_cookie ~* “comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_logged_in”) { set $cache_uri ‘null cache’; }
location / { try_files /wp-content/cache/supercache/$http_host/$cache_uri/index.html $uri $uri/ /index.php ; # auth_basic “closed site”; # auth_basic_user_file .htpasswd; }
location /phpmyadmin {
root /usr/share/nginx/www;
index index.php index.html index.htm;
location ~ ^/phpmyadmin/(.+\.php)$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
}
auth_basic "closed site";
auth_basic_user_file .htpasswd;
}
#location /phpmyadmin {
#}
location ~ .php$ { # try_files $uri = 404; fastcgi_split_path_info ^(.+.php)(.*)$; fastcgi_index index.php; #fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; fastcgi_intercept_errors on; fastcgi_ignore_client_abort off; fastcgi_connect_timeout 60; fastcgi_send_timeout 180; fastcgi_read_timeout 300; fastcgi_buffer_size 128k; fastcgi_buffers 4 256k; fastcgi_busy_buffers_size 256k; fastcgi_temp_file_write_size 256k;
}
location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { log_not_found off; access_log off; }
error_page 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/www;
}
#location /nginx_status {
# Turn on stats
#stub_status on;
#access_log off;
# only allow access from 77.103.27.165 #
#allow 89.177.49.138;
#deny all;
#}
location ~* .(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ { expires max; log_not_found off; access_log off; } ` One of the PHP errors we are getting is:
2014/03/19 18:53:02 [error] 768#0: *666936 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: xxx.xxx.xxx.xxx, server: website.com, request: "GET /article-url/?cf_action=sync_comments&post_id=4713 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.website.com", referrer: "http://www.website.com/article-url/"
Thanks, Paul
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.
502 errors means php5-fpm is crashing. Try checking its error logs (/var/log/php-fpm.log) for more info on why it’s crashing.