Configure Apache Virtual Hosts via Webmin

Configure Virtual Hosts

"The term Virtual Host refers to the practice of maintaining more than one server on one machine, as differentiated by their apparent hostname. For example, it is often desirable for companies sharing a web server to have their own domains, with web servers accessible as www.company1.com and www.company2.com, without requiring the user to know any extra path information. Apache was one of the first servers to support IP-based virtual hosts right out of the box. Versions 1.1 and later of Apache support both, IP-based and name-based virtual hosts (vhosts). The latter variant of virtual hosts is sometimes also called host-based or non-IP virtual hosts."
Apache Home
This tutorial shows how to configure Apache Virtual Hosts via Webmin on your VPS/Dedicated Server.

Add a Website / Virtual Host

  • Login to Webmin
  • Navigate to Servers >> Apache Web Server
  • Select the tab "Global Configuration"
  • Select the link "Edit Config Files"
  • Ensure "httpd.conf" is the selected config files to edit
  • Navigate to the section for virtual hosts (near the bottom)
  • Create a Virtual Host <VirtualHost>
    </VirtualHost>
  • Enable this Host for any address on port 80 <VirtualHost *:80>
    </VirtualHost>
  • Specify the server name <VirtualHost *:80>
    ServerName www.yourdomain.com
    </VirtualHost>
  • Specify the server aliases, space separated<VirtualHost *:80>
    ServerName www.yourdomain.com
    ServerAlias yourdomain.com www.yourdomain.com
    </VirtualHost>
  • Specify the root directory <VirtualHost *:80>
    ServerName www.yourdomain.com
    ServerAlias yourdomain.com www.yourdomain.com
    DocumentRoot /home/yourdomain.com/public_html
    </VirtualHost>
  • Specify an error log <VirtualHost *:80>
    ServerName www.yourdomain.com
    ServerAlias yourdomain.com www.yourdomain.com
    DocumentRoot /home/yourdomain.com/public_html
    ErrorLog logs/yourdomain.com-error_log
    </VirtualHost>
  • Specify a web log <VirtualHost *:80>
    ServerName www.yourdomain.com
    ServerAlias yourdomain.com www.yourdomain.com
    DocumentRoot /home/yourdomain.com/public_html
    ErrorLog logs/yourdomain.com-error_log
    CustomLog logs/yourdomain.com-access_log combined
    </VirtualHost>
  • Specify an administrator to email errors to <VirtualHost *:80>
    ServerName www.yourdomain.com
    ServerAlias yourdomain.com www.yourdomain.com
    DocumentRoot /home/yourdomain.com/public_html
    ErrorLog logs/yourdomain.com-error_log
    CustomLog logs/yourdomain.com-access_log combined
    ServerAdmin webmaster@yourdomain.com
    </VirtualHost>
  • Select the link "Save"
  • Select the link "Apply Changes"

Extra Notes

If a request is sent to the server that matches none of the existing virtual hosts, the first virtual host will be used.

Comment


Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/sakuiwe1/public_html/articles/configure_apache_virtual_hosts/index.php on line 122









 
My Account
Search the Articles


Article Archive
1.  2008-12
2.  2008-11
3.  2008-10
Article Categories
1.  General
2.  Hosting
3.  Linux
4.  SEO
Sponsored By