We recently had to install Apache on a RedHat server which is very quick via RPM, however setting it up so it acts in a fashion familiar to those who use shared hosting comes with a few gotchas. Here are the steps once the RPM installation is complete:
Create the following directories in the user folder:
mkdir /home/myuser/logs
mkdir /home/myuser/public_html
Create the necessary Apache log files:
touch /home/myuser/logs/access_log
touch /home/myuser/logs/error_log
Set permissions:
chmod -R 755 /home/myuser/
chmod 644 /home/myuser/logs/access_log
chmod 644 /home/myuser/logs/error_log
Add the following to the Apache configuration file and adjust where necessary:
/etc/httpd/conf/httpd.conf
ServerAdmin [email protected]
DocumentRoot /home/myuser/public_html
ServerName example.com
ErrorLog /home/myuser/logs/error_log
CustomLog /home/myuser/logs/access_log common
Set Apache to run at boot:
sudo chkconfig httpd on
Once all of that is done Apache should automatically come up at boot.