Install And Configure Apache

  • Install apache

    sudo yum install httpd

  • Start httpd service

    sudo service httpd start

direct your browser to your server’s IP address

Note :- if you are not able to access check firewall(iptables). Sudo service iptables stop .

  • Create Virtual Hosts

    1. create below directory

      sudo mkdir -p /var/www/schoolofdevops
       cd /var/www/schoolofdevops
    

    2. create index.html file and put below content

    <h1> Welcome to School of Devops</h1>

    3. create new virtual host file

    sudo touch /etc/httpd/conf.d/schoolofdevops.conf

    4. put below contenet in new virtual host file i.e. schoolofdevops.conf

    <VirtualHost *:80> 
         ServerAdmin root
         ServerName schoolofdevops.org
         ServerAlias www.schoolofdevops.org
         DocumentRoot /var/www/schoolofdevops/
    </VirtualHost>
    

    5. restart httpd service

    sudo service httpd restart

    6. visit our new page (http://serverip)

  • attach ssl certificate to schoolofdevops site

    1. create ssl certificate and store them in /etc/httpd/ssl directory

    follow this lab to create ssl certificate

    2. install mod_ssl module

    sudo yum install mod_ssl

    3. add below contenet in /etc/httpd/conf.d/schoolofdevops.conf file

    <VirtualHost *:443>
      ServerAdmin root
      ServerName schoolofdevops.org
      ServerAlias www.schoolofdevops.org
      DocumentRoot /var/www/schoolofdevops/
      SSLEngine on
      SSLCertificateFile /etc/httpd/ssl/server.crt
      SSLCertificateKeyFile /etc/httpd/ssl/server.key
    </VirtualHost>
    

    4. visit our https page (https://serverip)

    Click on Proceed to IP button to check your page