Setup Apache Server

The Apache HTTP Server Project is an effort to develop and maintain an open-source HTTP server for modern operating systems including UNIX and Windows NT. The goal of this project is to provide a secure, efficient and extensible server that provides HTTP services in sync with the current HTTP standards.

Here is guide to Setup Apache Server on CentOS. This post using yum to setup Apache Server

  1. Setup Apache Server in CentOS

    a. Install: yum -y install httpd

    b. Config httpd as service: chkconfig httpd on

    c. Start httpd: service httpd start

  2. Configure Apache Server

    a. Set web root document

    Open httpd.conf file

    vi /etc/httpd/conf/httpd.conf
    

    and edit following line

    DocumentRoot "/var/www/html"
    <Directory "/var/www/html">
    

    b. Open port 80 for Apache Server by command line:

    # open port 80 and 443 for everyone
    /sbin/iptables -A INPUT -m state --state NEW -p tcp --dport 80 -j ACCEPT
    /sbin/iptables -A INPUT -m state --state NEW -p tcp --dport 443 -j ACCEPT
    # save newly added firewall rules
    /sbin/service iptables save
    # verify new firewall settings
    /sbin/iptables -L -n -v
    /sbin/iptables -L INPUT -n -v
    /sbin/iptables -L INPUT -n -v | grep :80
    /sbin/iptables -L INPUT -n -v | grep :443
    

    c. Open port 80 for Apache Server by GUI (Centos 6):

    System > Administration > Firewall

    Open port 80 (HTTP)

    d. Test Apache Server:

    Open browser and goto url: http://<server-ip>:80 or http://<server-ip>

Comments

Popular posts from this blog

Reduce TIME_WAIT Socket Connections