Apache http server problems

apacheApache2

I am using Apache version 2.2.20 (ubuntu) and attempting to use a custom httpd.conf setup however I am getting the following error message and would appreciate any guidance that can be given to me. I'm part of a dev team and was given this custom httpd.conf file so I don't really assume it to be the cause of the problem (but I'm not totally ruling out that possibility).

I run the command "sudo apache2ctl -k restart" and get the following result

[Fri Jul 06 11:33:34 2012] [warn] module ssl_module is already loaded, skipping
[Fri Jul 06 11:33:34 2012] [warn] module rewrite_module is already loaded, skipping
httpd not running, trying to start
(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
Action '-k restart' failed.
The Apache error log may have more information.

The two warnings I can get rid of if I comment out the lines (below) in my httpd.conf file. Do I really want to do this? Where can I go in order to verify that these modules are loaded somewhere else and that commenting them out in my conf file won't hurt anything?

LoadModule ssl_module modules/mod_ssl.so
LoadModule rewrite_module modules/mod_rewrite.so

As for the error related to not being able to bind to port 80, I cannot get it to go away. When I do a "sudo netstat -lnp | grep :80" I get the following

tcp        0      0 0.0.0.0:80       0.0.0.0:*      LISTEN      6233/apache2

I know that the above output means that apache thinks its running and for a time I was even able to see the "It Worked!" page when I navigated to localhost, but NOW I only get "Not Found Apache/2.2.20 (ubuntu) server at localhost port 443" when I go to that page. Also I cannot seem to kill the apache process running the "kill -9 6233" command only causes apache's PID to change (for example from 6233 to 6234). I have also tried to use the command "sudo etc/init.d/apache2 stop", it produces an "* Stopping web server apache2 [ OK ]" message but again I see the apache2 process taking up port 80.

Ideas on any of these issues would be appreciated.

Best Answer

Look: "module xxx_module is already loaded"

Answer: You are loading those modules more than once. Try a search and comment/delete problematic lines:

In Centos/RHEL:

grep ssl_module -rI /etc/httpd/*   
/etc/httpd/conf/httpd.conf:LoadModule ssl_module /usr/lib64/httpd/modules/mod_ssl.so
/etc/httpd/conf.d/ssl.conf:LoadModule ssl_module modules/mod_ssl.so

In this case ^ I commented out line in /etc/httpd/conf/httpd.conf so all SSL stuff live in /etc/httpd/conf.d/ssl.conf

Same for rewrite_module

grep rewrite_module -rI /etc/httpd/*

In Debian/Ubuntu:

grep ssl_module -rI /etc/apache2/*
Related Topic