0% found this document useful (0 votes)
5 views11 pages

32.2. Virtual Web Hosting

This document provides instructions for installing and configuring the Apache web server, including enabling and starting the service, configuring firewall settings, and setting up virtual hosting. It details how to create a custom home page and configure the server to serve content from specific directories. Additionally, it includes steps to update the hosts file for local domain resolution.

Uploaded by

Swarnim
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views11 pages

32.2. Virtual Web Hosting

This document provides instructions for installing and configuring the Apache web server, including enabling and starting the service, configuring firewall settings, and setting up virtual hosting. It details how to create a custom home page and configure the server to serve content from specific directories. Additionally, it includes steps to update the hosts file for local domain resolution.

Uploaded by

Swarnim
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

# yum install http* -y

# systemctl enable httpd


# systemctl start httpd
#firewall-cmd --permanent --add-service=http
#firewall-cmd --reload
By default the Apache web server will greet you with a default welcome page.
To disable the default Apache welcome page insert
your index.html into /var/www/html/ directory
#cd /etc/httpd/conf.d/

#vim server1.conf
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName server1.example.com
DocumentRoot /var/www/html

</VirtualHost>
<Directory "/var/www/html">
<RequireAll>
Require all granted
</RequireAll>
</Directory>
wq
systemctl restart httpd
#mkdir /usr/local/vhosts
#cd /usr/local/vhosts

Create home page for virtual hosting


#vim index.html
Welcome to Virtual Hosting

:wq

#semanage fcontext -a -t httpd_sys_content_t


“/usr/local/vhosts(/.*)?”
#restorcon -Rv /usr/local/vhosts
#vim /etc/httpd/conf.d/vhosts.conf
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName vhosts1.example.com
DocumentRoot /usr/local/vhosts
</VirtualHost>

<Directory "/usr/local/vhosts">
<RequireAll>
Require all granted
</RequireAll>
</Directory>
:wq

#systemctl restart httpd


#vim /ets/hosts

192.168.1.10 server1.example.com
192.168.1.10 vhosts1.example.com
To access your new sample website navigate your client web browser
to either

http://server1.example.com
http://vhosts1.example.com

You might also like