Help with Apache Crashing
I need some help from an Apache/WordPress/Unix pro to find and fix a problem that I just started having with my VPS last week.
The symptom is that after running for several hours (or even several minutes some times), Apache will "go down" -- stop serving web pages.
Apache (linux) is serving about 50 domains on this VPS.
Almost all of the domains are running wordpress and were working fine a week ago. Recently, Apache started going down with increasing frequency.
The issue looks to be that the server is using up all of it's resources.
Below is a snip from a netstat -anp which shows the open connections to my server. Note that the server is connecting to itself over port 80 (apache). This is actually happening hundreds of times.
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 1 0 xx.yyy.zz.106:41446 xx.yyy.zz.106:80 CLOSE_WAIT 13578/httpd
tcp 1 0 xx.yyy.zz.106:41445 xx.yyy.zz.106:80 CLOSE_WAIT 13575/httpd
tcp 1 0 xx.yyy.zz.106:41444 xx.yyy.zz.106:80 CLOSE_WAIT 13571/httpd
tcp 1 0 xx.yyy.zz.106:41443 xx.yyy.zz.106:80 CLOSE_WAIT 13568/httpd
tcp 1 0 xx.yyy.zz.106:41442 xx.yyy.zz.106:80 CLOSE_WAIT 13572/httpd
tcp 1 0 xx.yyy.zz.106:41441 xx.yyy.zz.106:80 CLOSE_WAIT 13567/httpd
tcp 1 0 xx.yyy.zz.106:41440 xx.yyy.zz.106:80 CLOSE_WAIT 13543/httpd
tcp 1 0 xx.yyy.zz.106:41455 xx.yyy.zz.106:80 CLOSE_WAIT 13604/httpd
tcp 1 0 xx.yyy.zz.106:41454 xx.yyy.zz.106:80 CLOSE_WAIT 13600/httpd
tcp 1 0 xx.yyy.zz.106:41453 xx.yyy.zz.106:80 CLOSE_WAIT 13599/httpd
tcp 1 0 xx.yyy.zz.106:41452 xx.yyy.zz.106:80 CLOSE_WAIT 13598/httpd
tcp 1 0 xx.yyy.zz.106:41451 xx.yyy.zz.106:80 CLOSE_WAIT 13596/httpd
There are many domains which are connecting to themselves. The number to the left of them is the number of times it's that the server has connected to itself. The below information was gathered from the apache logs.
110 nicheadsensethemes.com and nicheadsensethemes.com/support
There are many more domains showing this behavior.
All the domains are running WordPress with several plugins. I am expecting WordPress is the problem, but I am not sure.
The helpdesk at my host indicated that typically this type of issue comes from an incorrectly written include or require statment. Rather then using the filepath to include something -- the coder has written http://domain.com/path/to/file. They find that most times it's a header or footer which is included this way.
I have grepped the entire /home file structure looking for this sort of construct with no luck.
Bottom line -- I am out of my depth and I need someone to help diagnose and fix this problem.
I have temporarily stopped the bleeding by creating a cron job the restarts Apache every 15 minutes (how embarrassing). Anyway, at least that has me up and running most of the time.
Any suggestions? I don't even know where to start.