How to install Apache on CentOS?

First you need to install Apache using this command

yum install httpd

You then need to modify the apache global configurations to allow htaccess rules on your sites to override default rules, you can do that by editing the httpd.conf file using the command

vi /etc/httpd/conf/httpd.conf

then modify the following line

AllowOveride None

to

AllowOveride All

Save the file then run the following command

chkconfig httpd on

This will make sure that apache runs at startup, then turn it on using the following command

service httpd start

To access your server from the outside world you need to disable the iptables firewall, use this command

service iptables stop

Then type your machine IP address in the browser and you should be able to view a page similar to this one

I hope you have enjoyed this tutorial and stay tuned for more to come

Share this post