What is HTTP/Apache?
The Apache HTTP server is a software (or program) that runs in the background under an appropriate operating system,
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 /etc/httpd/conf.d/welcome.conf /etc/httpd/conf/httpd.conf /etc/httpd/conf/magic /etc/logrotate.d/httpd /etc/sysconfig/htcacheclean /etc/sysconfig/httpd..... /var/www/error/include/top.html 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 http://192.168.1.1 (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 <h1> This is my first RHEL webserver, Hello World !! </h1> :wq!
Step:9 restart the HTTP server # service <httpd> restart Again, go to browser and hit your ex: IP http://192.168.1.1 & you should see your custom page.
Let us see what is HTTP/Apache Virtual Host?
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
CustomLog logs/host01.example.com-access_log common
CustomLog logs/host02.example.com-access_log common