apache server stops

Jose Bredariol
Jose Bredariol used Ask the Experts™
on
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 ?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Jason CarsonComputer Technician
Top Expert 2015
Commented:
Are there any hints in your logs as to what might be happening?
Uros Gaberdirector
Commented:
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.)

Author

Commented:
Do you mean on apache log ?
I can´t access the files on /etc/log/apache2
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Jason CarsonComputer Technician
Top Expert 2015
Commented:
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

su
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
Distinguished Expert 2017
Commented:
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 Engineer
Commented:
Hello,

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".

Author

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
Distinguished Expert 2017
Commented:
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 Gaberdirector
Commented:
DocumentRoot directive sets the path to the directory which holds the website, DocumentIndex is the directive which actually sets which file is "index".

Author

Commented:
netstat -an |grep ':80'|grep -i "established" | wc -l  = 56
Distinguished Expert 2017
Commented:
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..

uptime
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.

Author

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

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial