👉 This post was initially written in 2007 and referred to specific software versions. When troubleshooting your system, always consider which version and environment you are using.
Remember that the correct way to start the apache server is to use the apachectl
command.
apachectl stop
apachectl start
apachectl graceful
You can also check your configuration files using apachectl configtest
.
Address Already in Use
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:443
no listening sockets available, shutting down
This is caused by one or more processes running on the 443 (secure socket) port. You can get all the process ID’s that are running on this port with the command fuser
or a more classical ps auxww
with a less readable format.
[me@host ~]$ fuser 443/tcp
443/tcp: 7977 6815 9819 35217
# Now you just have to do a **kill** on those process.
[me@host ~]$ kill -9 7977 6815 9819 35217
# Or in a single line:
[me@host ~]$ kill -9 $(fuser 443/tcp 2>/dev/null)
No space left on device
(28)No space left on device: Couldn't create accept lock
# or
(28)No space left on device: mod_rewrite: could not create rewrite_log_lock Configuration Failed
When you check your storage, you find out that you have plenty of space still available. So, what is going on? The problem comes from apache that was not shutdown properly and left a lot of semaphore-arrays behind. Semaphore arrays are use for interprocess communication (ipc). So, here comes the ipcs
command. ipcs
provides information on the ipc facilities for which the calling process has read acccess.
[me@host ~]$ ipcs -s | grep www-data
0x00000000 163840 www-data 600 1
0x00000000 196609 www-data 600 1
0x00000000 229378 www-data 600 1
Before restarting your apache you have to remove all this semaphore arrays by using the ipcrm
command. ipcrm
removes a message queue, semaphore set or shared memory id.
[me@host ~]$ ipcs -s | grep www-data | perl -e "while () { @a=split(/\s+/); print \`ipcrm sem $a[1]\`}"