Documentation:Virtual Hosting

=Virtual Hosting=

UGCS allows users to host virtual domains on UGCS. This way, you can have some other domain (like yoursite.com or yoursite.caltech.edu) be hosted on UGCS hosting. The easiest way to set up virtual hosting is to run create_vhost on any machine in UGCS. This script will prompt you for the domain name and document root for your virtual domain.

You will also have to get DNS for your domain set up. If your domain is under caltech.edu, you can email the Caltech hostmaster (hostmaster@caltech.edu) with a request to make your domain a CNAME for "www.ugcs.caltech.edu".

Easy Way
The easiest way to create a vhost is to use the create-vhost script. From a shellserver, run create-vhost

It will prompt you for the domain name and document root, and then create the file and update the server configuration.

Hard Way
Virtual host configurations are stored in /afs/.ugcs/drop/vhost/ This directory can be created by running remctl demeter vhost setup Then you need to create a configuration file. It's a pretty simple file format: any line beginning with # is ignored, blank lines are ignored. Parameter names are separated from values by an "=" sign. You need the following parameters: The following parameters are optional:
 * docroot: The document root for the virtual server. It needs to be under /afs/.ugcs/user/
 * name: The primary name for the server. You should use a FQDN here.  You are not allowed to create virtual domains under ugcs.caltech.edu
 * cgibin: A cgi-bin directory for your server.  Like docroot, it needs to be under /afs/.ugcs/user/ .  This parameter is optional (if you leave it out, you won't have a cgi-bin)
 * aliases: Other names you want to be able to access the server at.  Multiple values should be separated by spaces.  If you have a caltech.edu host, you should have the part before .caltech.edu as an alias (as in the example)

An example for hosting the domain "justatest.caltech.edu" from "/afs/.ugcs/user/testuser/public/justatest is: docroot=/afs/.ugcs/user/testuser/public/justatest name=justatest.caltech.edu aliases=justatest

This file should go in /afs/.ugcs/drop/vhost/ /. You can give it whatever name you want, although we suggest using the server name to keep things simple (this will also help us find the file in case you need help debugging strange issues).

After modifying this file, you should run remctl demeter vhost update to update the server configuration files. This command will tell you if you have any errors. If not, it will update the server configuration and you'll be set!

Logs
You can see access logs for your site in /afs/.ugcs/apache-logs/ / .log

Errors will also be in /afs/.ugcs/apache-logs/ / -error.log

DNS Configuration
Your website address, the name specified in the drop file and any fully qualified aliases, should be configured as a CNAME in DNS to www.ugcs.caltech.edu. This gives us maximum flexibility in the future; hard-coded IP addresses or machine names may inadvertently break if systems are rearranged in the future.

If your domain is under caltech.edu, you can email the Caltech hostmaster (hostmaster@caltech.edu) with a request to make your domain a CNAME for "www.ugcs.caltech.edu" and they will take care of things for you.

Restrictions
Remember, UGCS domains cannot be used to host commercial sites or other content that violates our acceptable use policy. You are also not allowed to host domains under .ugcs.caltech.edu.

Virtual hosts do not work with SSL. Anyone who goes to https://yourvirtualdomain will instead go to the main UGCS homepage.