html
When Apache fails to start silently on Ubuntu, your first stop should be the error logs. The default locations are:
/var/log/apache2/error.log /var/log/syslog
For more verbose debugging during startup, run:
sudo apache2ctl -k start -e debug
Since this is a server migration from 9.04 to 9.10, watch for these specific issues:
# Check for deprecated directives apache2ctl -t # Verify module compatibility apache2ctl -M | grep php
Ubuntu 9.10 introduced changes in default services. Check for port 80 conflicts:
sudo netstat -tulnp | grep ':80' # If something else is using port 80: sudo lsof -i :80 -sTCP:LISTEN
Different Ubuntu versions may have different module dependencies:
# Compare loaded modules between servers diff <(apache2ctl -M) <(ssh primary-server "apache2ctl -M") # Common culprits: sudo a2enmod rewrite sudo a2enmod ssl
Even though you've rsync'd files, permissions might differ:
# Fix document root permissions sudo chown -R www-data:www-data /var/www # Verify critical dirs ls -la /var/lock/apache2 /var/run/apache2
Validate all config files before attempting restart:
# Check main config apache2ctl configtest # Check individual vhost files for f in /etc/apache2/sites-enabled/*; do echo "Checking $f"; apache2ctl -t -D DUMP_VHOSTS -f "$f"; done
Between 9.04 and 9.10, library dependencies changed:
# Check missing libraries ldd $(which apache2) # Compare with working server diff <(ldd $(which apache2)) <(ssh primary-server "ldd $(which apache2)")
The init script might hide useful output. Try direct execution:
sudo /usr/sbin/apache2 -k start -X -e debug
This runs Apache in foreground with maximum verbosity.
The first place to look when Apache fails to start is the error log. On Ubuntu, Apache logs are typically found in:
/var/log/apache2/error.log
You can view the last 50 lines with:
sudo tail -n 50 /var/log/apache2/error.log
Before attempting to start Apache, always verify your configuration:
sudo apache2ctl configtest
Common configuration issues include:
- Missing semicolons or quotes
- Invalid directives for your Apache version
- Incorrect file permissions
Check if another service is using port 80 or 443:
sudo netstat -tulpn | grep ':80\|:443'
If you find conflicts, either stop the competing service or configure Apache to use different ports.
Missing or misconfigured modules can prevent Apache from starting. List loaded modules:
apache2ctl -M
Enable required modules with:
sudo a2enmod module_name
Apache needs proper permissions to access its configuration and document root:
sudo chown -R www-data:www-data /var/www
sudo chmod -R 755 /var/www
Check your virtual host files for errors. A basic example:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Check system resources that might prevent Apache from starting:
free -m
df -h
Try starting Apache in debug mode for more verbose output:
sudo apache2ctl -X
Or check systemd status:
sudo systemctl status apache2
Since you're running Ubuntu 9.10 (which is quite old), be aware of:
- Different init systems (Upstart vs Systemd)
- Older Apache versions may have different configuration syntax
- Potential library incompatibilities
After making changes, always:
sudo systemctl restart apache2
sudo systemctl status apache2
And verify the service is actually running:
ps aux | grep apache