Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Apache randomly shutdown and cant restart. Port 80 used by perl processes. When I kill processes which use port 80, apache can restart again.

log and results :

tail -50 /var/log/httpd/error_log

[Sat Jan 07 00:11:01 2012] [notice] caught SIGTERM, shutting down

ns1:/proc/15852# fuser -n tcp 80

80/tcp:               6072 15849 15852

ns1:/proc/15852# ls -l

total 0
-r-------- 1 apache apache 0 2012-01-07 00:30 auxv
-r--r--r-- 1 apache apache 0 2012-01-07 00:24 cmdline
-rw-r--r-- 1 apache apache 0 2012-01-07 00:30 coredump_filter
-r--r--r-- 1 apache apache 0 2012-01-07 00:30 cpuset
lrwxrwxrwx 1 apache apache 0 2012-01-07 00:37 cwd -> /var/www/html/phpMyAdmin-2.11.5-all-languages
-r-------- 1 apache apache 0 2012-01-07 00:24 environ
lrwxrwxrwx 1 apache apache 0 2012-01-07 00:37 exe -> /usr/bin/perl
dr-x------ 2 apache apache 0 2012-01-07 00:37 fd
-r--r--r-- 1 apache apache 0 2012-01-07 00:30 io
-r-------- 1 apache apache 0 2012-01-07 00:30 limits
-rw-r--r-- 1 apache apache 0 2012-01-07 00:30 loginuid
-r--r--r-- 1 apache apache 0 2012-01-07 00:37 maps
-rw------- 1 apache apache 0 2012-01-07 00:30 mem
-r--r--r-- 1 apache apache 0 2012-01-07 00:30 mounts
-r-------- 1 apache apache 0 2012-01-07 00:30 mountstats
-rw-r--r-- 1 apache apache 0 2012-01-07 00:30 oom_adj
-r--r--r-- 1 apache apache 0 2012-01-07 00:30 oom_score
lrwxrwxrwx 1 apache apache 0 2012-01-07 00:37 root -> /
-r--r--r-- 1 apache apache 0 2012-01-07 00:30 schedstat
-r-------- 1 apache apache 0 2012-01-07 00:30 smaps
-r--r--r-- 1 apache apache 0 2012-01-07 00:24 stat
-r--r--r-- 1 apache apache 0 2012-01-07 00:30 statm
-r--r--r-- 1 apache apache 0 2012-01-07 00:24 status
dr-xr-xr-x 3 apache apache 0 2012-01-07 00:30 task
-r--r--r-- 1 apache apache 0 2012-01-07 00:30 wchan

ns1:/proc/15852# /etc/init.d/httpd restart

Stopping httpd:
Starting httpd: Warning: DocumentRoot [/xxx/public_html] does not exist
Warning: DocumentRoot [/xxx/private_html] does not exist
[Sat Jan 07 00:48:37 2012] [warn] NameVirtualHost xx.xx.xx.xx:80 has no VirtualHosts
[Sat Jan 07 00:48:37 2012] [warn] NameVirtualHost xx.xx.xx.xx:443 has no VirtualHosts
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs

Randomly, I mean, Uncertain time, some times in night when server has very low traffic. Sometimes has more traffic.

I don't know other process are taking port 80 or apache still usign port 80. If other process are taking port 80, I want to know which proceses and why they taking. And how can I avoid this.

In question there is a proc directory ls result of process (pid number 15852). This process using port 80. Maybe it will help to recognize problem.

In http error log there is only line about this problem:

[Sat Jan 07 00:11:01 2012] [notice] caught SIGTERM, shutting down

---- New edit, problem happend again. I try netstat command and in this case pid id 7574 ----

netstat -tpnl | grep ":80" result :

ns1:~# netstat -tpnl | grep ":80"
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 7574/apache3 -k sta 

ns1:/proc/7574# more cmdline
/usr/sbin/apache3 -k start
ns1:/proc/7574# ls /usr/sbin/apache3
ls: cannot access /usr/sbin/apache3: No such file or directory
share|improve this question
    
Define "randomly", when does it shut down (and do you have the logs from one of those shutdowns)? And why do you have other processes taking port 80? –  Shane Madden Jan 7 '12 at 0:24
    
Your fuser command doesnt indicate anything. Just because something is using a port, doesnt mean its bound to it for listening (which is the issue). Try netstat -tpnl | grep ":80" instead –  Patrick Jan 7 '12 at 4:44
    
ns1:~# netstat -tpnl | grep ":80" Here is result : tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 7574/apache3 -k sta –  Kivanc Erten Jan 9 '12 at 8:50
    
ns1:/proc/7574# more cmdline /usr/sbin/apache3 -k start ns1:/proc/7574# ls /usr/sbin/apache3 ls: cannot access /usr/sbin/apache3: No such file or directory –  Kivanc Erten Jan 9 '12 at 8:56
    
That netstat comment shows that its apache3 listening on port 80, so its already running and this is why you cant start it again. –  Patrick Jan 11 '12 at 1:54

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.