| Apache 2.x installation and setup on Red Hat (and CentOS) |
|
|
|
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.
|




