apache server stops

My web server (linux debian/apache2)  are stopping answer. I have to restart apache to get the site online again.
How can I fix it ?
Jose BredariolPMPAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jason CarsonComputer TechnicianCommented:
Are there any hints in your logs as to what might be happening?
Uros GaberdirectorCommented:
Check if the server has enough RAM available, you can also manage process throttling/lifetime via httpd.conf settings:
Timeout - how long does server wait for request and response to be acknowledged, if your website is not receiving any large amounts of data - i.e. mostly serving information - try lowering this
KeepAlive - whether or not the client has to make single connection per single request
MaxKeepAliveRequests - how many requests can be made in a single connection (if previous is True)
KeepAliveTimeout - how long can the connection be left open without additional request
MinSpareServers - how many server processes must be available in queue (min)
MaxSpareServers - --||--  (max)
MaxRequestsPerChild - how many requests will single process answer before exiting - try this with lower settings as if there are problems in your application high value for this can cause lockups (memory leaks etc.)
Jose BredariolPMPAuthor Commented:
Do you mean on apache log ?
I can´t access the files on /etc/log/apache2
Your Guide to Achieving IT Business Success

The IT Service Excellence Tool Kit has best practices to keep your clients happy and business booming. Inside, you’ll find everything you need to increase client satisfaction and retention, become more competitive, and increase your overall success.

Jason CarsonComputer TechnicianCommented:
I know of 2 ways to access the apache logs on the command line

1) If you su (not sudo) you can then enter that directory

enter root password
cd /etc/log/apache2

2) sudo usermod -aG adm Username       (Replace Username with your username)

log out, then back in and you will be able to access that directory
usually the logs should be in /var/log/httpd or apache or apache2

you are either under a DOS attack, netstat -an  | grep ':80' | wc -l
if the number is large, that means that are more connections that your system can handle in the current configuration (possible issue as was pointed out earlier lack of RAM)
The other can also be impacted by what has to be done for the server to answer, php database, etc. or you implemented some restriction to curtail attacks and that is what is causing the DOS........
without the logs I am merely speculating on the various possibilities.
Saravanan PalanisamySystems EngineerCommented:

Try to restart your apache server again, it will show the error in terminal then you will fix it.
Otherwise please check the config test in apache "apache2ctl -t".
Jose BredariolPMPAuthor Commented:
the only error I´m getting is : DocummentRoot index.php does not exist. But he is there.
My server is intel I5 8Gb ram and Hard disk 500Gb.
netstat -an  | grep ':80' | wc -l  shows me 297 connections
what log do you want : error.log or access.log
Do you only have a single site, or multiple?  Access.log of each site ... can be used to see which IPs and pages are being accessed/requested.
Error.log will point to a possible issue.
You gave a typo DocumentRoot .......

You can use httpd to display the current virtual host configuration.......
DO MOT RECALL/have on hand the virt_host I think is the option........

Try the modified
netstat -an |grep ':80'|grep -i "established" | wc -l
Uros GaberdirectorCommented:
DocumentRoot directive sets the path to the directory which holds the website, DocumentIndex is the directive which actually sets which file is "index".
Jose BredariolPMPAuthor Commented:
netstat -an |grep ':80'|grep -i "established" | wc -l  = 56
What about the logs?
That is the only place from which you can see what might have caused it to crash, or it might not be responding because something that the pages are trying to access is not responding.

run top -n 2
What you are looking on the second pass is the line
Cpu(s):  0.2%us,  0.2%sy,  0.0%ni, 74.6%id, 25.0%wa,  0.0%hi,  0.0%si,  0.0%st
states are user %us, system %sy, wait state %wa  
if you have a high %wa that means your system is waiting likely for disk IO to complete..

I5 four, six, eight core? the uptime should have a number less than the number of cores
load output is 1, 5, 15 minute average,

vmstat is to check load on the memory/cache
iostat -xtc 5 5
will give you disk and some memory access stats (5 refresh 5 seconds apart)
Since you have a single drive, you might have an IO bottleneck on the drive.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jose BredariolPMPAuthor Commented:
I looked at log files. I think my problems were with php code. So many erros. The programmer corrected all of them, now the site is ok. I´ll stay monitoring. thanks all
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Web Server

From novice to tech pro — start learning today.