Home Linux Red Hat Enterprise Server and CentOS
Apache 2.x installation and setup on Red Hat (and CentOS) Print E-mail
Installing Apache (httpd) version 2.x on Red Hat based systems (Inc CentOS)

Install apache web server (httpd)
yum install httpd
Start apache (httpd) daemon
/etc/init.d/httpd start
Set httpd to start at init levels 3, 4, 5 (This way it will start at the next system restart automatically)
/usr/sbin/chkconfig --level 345 httpd on
Note down the Servers IP Address (e.g. “inet addr:123.123.123.123”)
/sbin/ifconfig
Open a web browser and check you can get a default test page from the webserver.
Open Firefox or IE and browse to http://123.123.123.123

Default location of httpd logs to troubleshoot problems:
cd /var/log/httpd tail error_log tail access_log
Default location of configuration files
cd /etc/htttpd/conf/ vim httpd.conf
Set the ServerName in httpd.conf
Set the ServerName to the server’s hostname (e.g. srv-web-001) to resolve the following warning on startup.
“Could not determine the server's fully qualified domain name, using 127.0.0.1 for ServerName”
Test your new config before restarting httpd
/usr/sbin/apachectl –t
Restart httpd
/etc/init.g/httpd restart
Note: This will kill off all the current httpd processes before it starts a new parent process.
OR
/etc/init.d/httpd graceful
Note: This will kill the parent process and then starts a new one with your new config. This way it leaves the child processes to complete and then when a new child process is required it starts from the new parent process hence using the new configuration file. Using this method saves disrupting connected users.

A list of all the configuration directives can be found here:
http://httpd.apache.org/docs/2.0/mod/quickreference.html
Place your HTML web content in the default document root.
This is a very basic setup of apache that will currently only serve up one site from your default document root “/var/www/”.
Place your html files into “/var/www/html/”
For example create a file named index.html and insert the following to test your setup further.
 

        
            

      

 

DISCLAIMER: All advice, tips, guides and other information on this website is provided as-is with no warranty or guarantee. While most information is correct to the best of my knowledge, I am not reponsible for any issues that may arise in using the information, and you do so at your own risk. As always before doing anything; check, double check, test and always make a backup.

 

Help VMadmin

All resources on this site are provided absolutley free. However it takes time and money to keep the site running. If any information has been helpful to you or your company, and you wish to make a donation to help keep VMadmin.co.uk running you can do so via paypal, and it would be much appreciated.

Click to donate to VMadmin.co.uk via paypal.