Apache (httpd)
When you view a web page over the Internet,
the code to create that page must be retrieved from a server somewhere on the
Internet. The server that sends your web browser the code to display a web page
is called a web server. There are countless web servers all over the Internet
serving countless websites to people all over the world. Whether you need a web
server to host a website on the Internet a Red Hat Enterprise Linux server can
function as a web server using the Apache HTTP server.
The Apache HTTP server is a popular, open source server application that runs
on many UNIX-based systems as well as Microsoft Windows.
Suppose There are two sites server.test.edu and server45.test.edu. Both sites are mappings to 192.168.2.1
IP address. Configure the Apache web server for
these sites to make accessible on web
Configure web server
In this example we will configure a web
server.
necessary rpm for web server is httpd,
httpd-devel and apr check them for install
Configure virtual hosting
We need to copy any html file to the below location
Then update the hosts file if you have not.
now open /etc/httpd/conf/httpd.conf main configuration file
of apache server
Now
go in the end of file and copy last seven line [virtual host tag] and paste
them in the end of file. change these seven lines as shown in
now save this file and exit
from it
Then open browser & enter the hostname as below
Configure multiple sites with same ip address
At this point you have configured one site server.test.edu with
the ip address 192.168.2.1. Now
we will configure one more site server45.test.edu with same ip
address
create a documents root directory
for server45.test.edu website
and an index page
mkdir /var/www/virtual
chmod 777 /var/www/virtual
Then copy one html file to
particular location, refer below image
Again open /etc/httpd/conf/httpd.conf file.
Now go in the end of file and
copy last seven line [ virtual host tag ] and paste them in the end of file.
change these seven lines as shown in image
you have done necessary configuration now restart the httpd service
Then open browser & enter the hostname as server45.test.edu as shown below
No comments:
Post a Comment