Every hour or so I am starting to get 500 errors on wp-admin and wp-admin/admin-ajax.php in particular. I run DSO + APC + Nginx (admin) + Apache. Apache runs on port 8080 and Nginx on 80.
What I have done so far:
- I started looking into debug.log and took care of some fatal crashes that happened from time to time
- I added
0 */1 * * * /usr/sbin/tmpwatch -am 1 /tmp/nginx_client
because my log was indicating that tmp inodes were all used up and crashed nginx - Inspected other problems and upped PHP memory_limit to 128M
- For some reason my wp-admin folder was assigned to the user 1001, which I changed back to nobody:nobody (nginx currently run as nobody)
I am using the following vhosts configuration for the Nginx frontend:
# BEGIN W3TC Page Cache cache
location ~ /wp-content/cache/page_enhanced.*html$ {
add_header Vary "Accept-Encoding, Cookie";
add_header Pragma "no-cache";
add_header Cache-Control "max-age=0, private, no-store, no-cache, must-revalidate";
}
location ~ /wp-content/cache/page_enhanced.*gzip$ {
gzip off;
types {}
default_type text/html;
add_header Vary "Accept-Encoding, Cookie";
add_header Pragma "no-cache";
add_header Cache-Control "max-age=0, private, no-store, no-cache, must-revalidate";
add_header Content-Encoding gzip;
}
# END W3TC Page Cache cache
# BEGIN W3TC Page Cache core
#set $w3tc_rewrite 1;
set $w3tc_rewrite "";
if ($request_method = POST) {
set $w3tc_rewrite 0;
}
if ($query_string != "") {
set $w3tc_rewrite 0;
}
if ($http_cookie ~* "(comment_author|wp\-postpass|w3tc_logged_out|wordpress_logged_in|wptouch_switch_toggle)") {
set $w3tc_rewrite 0;
}
if ($http_user_agent ~* "(W3\ Total\ Cache/0\.9\.4)") {
set $w3tc_rewrite 0;
}
if ($http_cookie ~* "(w3tc_preview)") {
set $w3tc_rewrite _preview;
}
set $w3tc_enc "";
if ($http_accept_encoding ~ gzip) {
set $w3tc_enc _gzip;
}
set $w3tc_ext "";
if (-f "$document_root/wp-content/cache/page_enhanced/$http_host/$request_uri/_index$w3tc_rewrite.html$w3tc_enc") {
set $w3tc_ext .html;
}
if (-f "$document_root/wp-content/cache/page_enhanced/$http_host/$request_uri/_index$w3tc_rewrite.xml$w3tc_enc") {
set $w3tc_ext .xml;
}
if ($w3tc_ext = "") {
set $w3tc_rewrite 0;
}
#if ($w3tc_rewrite = 1) {
if ($w3tc_rewrite != 0) {
rewrite .* "/wp-content/cache/page_enhanced/$http_host/$request_uri/_index$w3tc_rewrite$w3tc_ext$w3tc_enc" last;
}
# END W3TC Page Cache core
I am excluding wp-admin - possible culprit here?
# Don't cache uris containing the following segments
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-location$
set $cache_uri 'null cache';
}
location / {
error_page 405 = @backend;
add_header X-Cache "HIT from Backend";
proxy_pass http://backend:8080;
include proxy.inc;
include microcache.inc;
}
Temporary workaround is restarting nginx. I am using a simple nginx.conf.