Difference between revisions of "Troubleshooting (Apache)"

Jump to navigation Jump to search
2,063 bytes added ,  11:55, 15 February 2012
Added " Address Already In Use"
(Initial creation - content from Apache page)
 
(Added " Address Already In Use")
Line 7: Line 7:
Perform the following in <code>/etc/apache2</code> folder to identify where the entries and delete the unwanted duplicates..
Perform the following in <code>/etc/apache2</code> folder to identify where the entries and delete the unwanted duplicates..
  grep NameVir * -R
  grep NameVir * -R
== Address Already In Use ==
On restarting Apache you get presented with the following error
(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
                                                                      [fail]
Apache is attempting to start but cannot bind (start listening on) TCP port 80 (or 443 if you're using SSL and the error refers to <code>0.0.0.0:443</code>, or another port if you're using non-standard ports.
The reason for the problem can vary, and you need ascertain what's already using the port by running netstat and grep'ing for port 80 (or whatever port Apache won't start on).
root@web2:/etc/apache2# netstat -lnp | grep :80
tcp        0      0 0.0.0.0:80              0.0.0.0:*              LISTEN      20482/apache2
* If Apache is already listening on the port (as shown in above example, running with [[Acronyms#P|PID]] 20482)
** There is either a problem with the Apache config, and its trying to listen on the port twice, or you've got an old rogue process knocking around.
*# Kill the process using the process ID
*#* EG <code> kill 20482 </code>
*# Restart Apache, if it starts OK - problem solved!, otherwise continue
*#* <code> service apache2 restart </code>
*# Check your config for multiple servers on the port
*#* EG <code> grep -r 80 /etc/apache2/conf.d/* /etc/apache2/*.conf /etc/apache2/sites-enabled/* </code>
*#* Multiple <code> <VirtualHost *:80> </code> are OK, multiple <code> Listen 80</code> or <code> NameVirtualHost *:80</code> are not, fix as required
* If its another process you need to track down the cause and resolve.
** If you haven't accidentally caused the problem, your server may have been breached.
*# Kill the process by name (dodgy.pl in example below, in-case there's more than one running)
*#* EG <code> killall -9 dodgy.pl </code>
*# From root, find the file and delete
*#* EG <code> cd / </code>
*#* EG <code> find -iname dodgy.pl </code>
*#* EG <code> rm -f /path/to/dodgy.pl </code>


[[Category:Apache]]
[[Category:Apache]]

Navigation menu