Updating, recompiling, VirtualHost templates, customizations,  php safemode …Apache won’t start and there is nothing in the logs

Updating, recompiling, VirtualHost templates, customizations,  php safemode …Apache won’t start and there is nothing in the logs

The Chances are, if apache is not starting and is not logging anything, the error_log is fully preventing apache from the starting.  To double check that, run:

cd /var/log/httpd
ls -lS | less

If any files are around 2-3 gig (or more), then chances are, that’s the problem.

The solution is for this is to remove the logs, restart apache, and then implement preventative measures.

1)

 

 

 

 

2) Get logrota to rotate daily

perl -pi -e ‘s/weekly/daily/’ /etc/logrotate.conf
perl -pi -e ‘s/rotate 4/rotate 2/’ /etc/logrotate.conf

If the apache still doe not  starting, check /var/log/messages and try recompiling apache.

Showing files in a directory

If you want to list all the files in a directory that doesn’t use an index.html (or index.php) file, you can create an .htaccess file with the following contents:

Options +Indexes

This will tell apache that you want to list all files in the directory.

Apache won’t restart: [crit] (98)Address already is in use: make_sock: could not bind to the port 8090

Please Note this is an old guide. It was for apache 1.3 with customapache.  The current boot script we will  provide shouldn’t have this issue.
If apache is not completely shutting down, then consider trying graceful restarts (see related link below) and also ensures your system is updated and such that you don’t have any outdated php scripts on the server.


[crit] (98)Address already in use: make_sock: could not bind to port 8090
or
[crit] (98)Address already in use: make_sock: could not bind to port 443
or
[crit] (98)Address already in use: make_sock: could not bind to port 80

If you see this error in your /var/log/httpd/error_log, it will mean that apache isn’t shutting down completely before trying to restart.  This means that the new process will not be able to bind to the given ports because they’re still are using by the old copy of apache that was not completely shut down.

To solve this issue, use a different boot script that will wait for all apache processes to stop before starting the new one:

cd /usr/local/directadmin/customapache
rm -f httpd*
./build update

Once you have the new scripts downloaded, you need to install all mentioned:

RedHat:

cp httpd /etc/init.d/httpd
chmod 755 /etc/init.d/httpd
chkconfig httpd reset

FreeBSD:

cp httpd_freebsd /usr/local/etc/rc.d/httpd
chmod 755 /usr/local/etc/rc.d/httpd

Leave a Reply

Your email address will not be published. Required fields are marked *