Module – 13 Linux Webserver Configuration – HTTP/Apache

What is HTTP/Apache?

The Apache HTTP server is a software (or program) that runs in the background under an appropriate operating system,

which supports multi-tasking and provides services to other applications that connect to it, such as client web browsers.apache

It was first developed to work with Linux/Unix operating systems, but was later adapted to work under other systems, including Windows and Mac.

The Apache binary running under UNIX is called HTTPd (short for HTTP daemon)


Step:1 Install HTTP server package
 # yum install –y http*
Step:2 Verify the HTTP Packages:
 # rpm -qa -c httpd

Step:3 Start the HTTP server
  # service httpd start
Step:4 Verify the HTTP server
  # service httpd status
Step:5 Check for TCP port 80 on listen state
  # netstat -an | grep 80
    tcp4       0      0  *.80                  *.*                    LISTEN     
Step:6 Enable to Auto-start during server reboot
  # chkconfig <httpd> on
Step:7 Now go to browser and hit your ex: IP  (Note: Try your server IP)
   If you see the below page, it means your web-server is working :-)
Step:8 Let us customize your webserver 
  # cd /var/www/html
  # touch index.html
  # vi index.html
         This is my first RHEL webserver, Hello World !!

Step:9 restart the HTTP server
  # service <httpd> restart

Again, go to browser and hit your ex: IP  & you should see your custom page.

Let us see what is HTTP/Apache Virtual Host?

The term Virtual Host refers to the practice of maintaining more than one web site on onevirutalhost Apache machine or server.

The NameVirtualHost directive is a required directive if you want to configure name-based virtual hosts.

With the NameVirtualHost directive you specify the IP address on which the server will receive requests for the name-based virtual hosts.

This will usually be the address to which your name-based virtual host names resolve.


cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf_orig

# Use name-based virtual hosting.

NameVirtualHost *:80                                             ------------> uncomment this line

### add the following lines for 2 instance

<VirtualHost *:80>
   DocumentRoot /var/www/html
   ServerAlias host01
   ErrorLog logs/
   CustomLog logs/ common

<VirtualHost *:80>
   DocumentRoot /www/html
   Serveralias host02
   ErrorLog logs/
   CustomLog logs/ common

Leave a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>