Thursday, 9 June 2011

Configure a system to run a default configuration HTTP server

In its simplest interpretation, the one I'm sticking to by the way, this is a fairly simple objective.
The first step is to install Apache
yum install httpd
 Now, you can switch it on with
service httpd start
Since you presumably want the web server to be running automatically at boot, you need to do the following:
chkconfig httpd on
That's it, you now have a apache running and configured to start at boot.  You just need to allow traffic to it, so open the firewall for port 80 and save it:
iptables -I INPUT -p tcp --dport http -j ACCEPT; iptables-save > /etc/sysconfig/iptables
You can check this by using a browser to navigate to localhost, e.g.
elinks 127.0.0.1
You can now add an index.html page, no need to worry about html, just do
echo "hello" > /var/www/html/index.html
if we try elinks again:

elinks 127.0.0.1
Obviously this is just the beginning and you can have a look at the configuration file for Apache, /etc/httpd/conf/httpd.conf, which is very well commented or you could have a look at the manual.

No comments:

Post a Comment