linux_wiki:configure_a_virtual_host

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
linux_wiki:configure_a_virtual_host [2016/10/08 17:55]
billdozor
linux_wiki:configure_a_virtual_host [2019/05/25 23:50] (current)
Line 12: Line 12:
   * server1.example.com (192.168.1.150) -> Perform all connectivity tests from here   * 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   * 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
  
 ---- ----
Line 17: Line 21:
 ====== Virtual Host Creation ====== ====== Virtual Host Creation ======
  
-Create virtual host file+**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> <code bash>
-vim /etc/httpd/conf.d/myvhost.conf+vim /etc/httpd/conf.d/vhosts.conf
  
 <VirtualHost *:80> <VirtualHost *:80>
-  ServerAdmin admin@myvhost.example.com +  # Basic Info (URL, Document Root) 
-  DocumentRoot /var/www/html/myvhost +  ServerName bluesite.example.com 
-  ServerName myvhost.example.com +  DocumentRoot /var/www/html/bluesite 
-  ErrorLog logs/myvhost-error_log + 
-  CustomLog logs/myvhost-access_log combined+  # Log files 
 +  ErrorLog logs/bluesite-error_log 
 +  CustomLog logs/bluesite-access_log combined
 </VirtualHost> </VirtualHost>
 </code> </code>
  
 \\ \\
-Create directory and index file for myvhost+On server2: Create directory and index file for myvhost
 <code bash> <code bash>
-mkdir /var/www/html/myvhost +mkdir /var/www/html/bluesite 
-echo "The myvhost virtual host index" > /var/www/html/myvhost/index.html+echo '<html><body>This is the <font color=blue>BLUE SITE</font>.</body></html>' > /var/www/html/bluesite/index.html
 </code> </code>
  
 \\ \\
-Restart httpd+On server2: Restart httpd
 <code bash> <code bash>
 systemctl restart httpd systemctl restart httpd
Line 44: Line 53:
  
 \\ \\
-Check virtual host site+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> <code bash>
-elinks http://myvhost.example.com+elinks http://bluesite.example.com
 </code> </code>
  
 ---- ----
  
  • linux_wiki/configure_a_virtual_host.1475963756.txt.gz
  • Last modified: 2019/05/25 23:50
  • (external edit)