Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== Configure A Virtual Host ====== **General Information** Red Hat preferred method of configuring virtual hosts. ---- ====== Lab Setup ====== The following virtual machines will be used: * server1.example.com (192.168.1.150) -> Perform all connectivity tests from here * server2.example.com (192.168.1.151) -> Install Apache Web Server here **Previous Sections Completed** * [[linux_wiki:network_services_overview_apache_web_server|Install/Configure]] * Except leave listening on port 80/tcp ---- ====== Virtual Host Creation ====== **Examples**: Example config at<code bash>less /usr/share/doc/httpd-2.4.6/httpd-vhosts.conf</code> \\ On server2: Create virtual host file <code bash> vim /etc/httpd/conf.d/vhosts.conf <VirtualHost *:80> # Basic Info (URL, Document Root) ServerName bluesite.example.com DocumentRoot /var/www/html/bluesite # Log files ErrorLog logs/bluesite-error_log CustomLog logs/bluesite-access_log combined </VirtualHost> </code> \\ On server2: Create directory and index file for myvhost <code bash> mkdir /var/www/html/bluesite echo '<html><body>This is the <font color=blue>BLUE SITE</font>.</body></html>' > /var/www/html/bluesite/index.html </code> \\ On server2: Restart httpd <code bash> systemctl restart httpd </code> \\ On server1: Create /etc/hosts entry for new name <code bash> vim /etc/hosts 192.168.1.151 server2 bluesite.example.com </code> \\ On server1: Check virtual host site <code bash> elinks http://bluesite.example.com </code> ---- linux_wiki/configure_a_virtual_host.txt Last modified: 2019/05/25 23:50(external edit)