Apache Configuation with html
Step 1 : Install packages for apache
[root#] yum install httpd*
Step 2 : Verify the packages of apache
[root#] rpmquery -qa | grep httpd
o/p:
httpd-2.2.15-5.el6.i686
httpd-tools-2.2.15-5.el6.i686
httpd-devel-2.2.15-5.el6.i686
httpd-manual-2.2.15-5.el6.noarch
Step 3 : Get the hostname
[root#] hostname
o/p:
server.tyit.com
Step 4 : Get the IPAddress
[root#] ifconfig
o/p:
192.168.2.111
Step 5 : Using GUI navigate to directory "/var/www"
5.1 Create a directory "virtual" inside this
5.2 Create a page "a.html" inside virtual and write following :
My Apache Server
This my html page with Apache server
Step 6: Open the configuration file "/etc/httpd/conf/httpd.conf"
Go to end of file :
#
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot /www/docs/dummy-host.example.com
# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#
ServerAdmin root@server.tyit.com
DocumentRoot /var/www/virtual
ServerName server.tyit.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
** Save the file and come to terminal
Step 7 : Give full permissions to virtual directory
[root#] chmod -R 777 /var/www/virtual
Step 8: Stop the firewall
[root#] service iptables stop
Step 9: Start and restart apache service
[root#] service httpd start
[root#] service httpd restart
Step 10 : Make the service enable at boot time
[root#] chkconfig httpd on
Testing
Open the Firefox browser and write in URL :
http://192.168.2.111/
http://192.168.2.111/a.html