View Full Version : Tutorial: Adding a secondary domain to a 3.0 VPS account

10-23-2010, 03:51 PM
It can be confusing to add a second domain to a VPS account. Unlike some other systems, site manager will not create a web directory for you beforehand, it isn't obvious where best to put this directory nor implications of placing it in different places. This is good because it gives you more options than most systems to place your domains wherever you like and reference them differently, but with more choice comes more required knowledge.

I know that there are already several threads that touch on this topic. However, they seem to be difficult to find and not always complete enough. This thread is an official set of 4 instructions on adding a new domain to a 3.0 account using site manager. There are obviously several different ways to do this based on how you want to run things, but these instructions will work for almost everyone and cause the least amount of issues.

In my instructions, I will be treating primarydomain.com as the primary domain and the new domain being added to the account will be newdomain.com. Please substitute your new domain name anywhere newdomain.com is mentioned. As with most sets of instructions

1.) Register the new domain. You can register the new domain at any registrar. If you want to register it through WestHost you can order it at http://order.westhost.com (on step 2 of the order select domain registration only). If you already have a cp.westhost.com login, order it from within that account using the domain name registration tool.

2.) Point the domain to WestHost 3.0 name servers. Even if you register the new domain through WestHost you will still need to point the domain to the 3.0 name servers as this is not done by default. At the registrar enter the following name servers for newdomain.com:
(For WestHost registered domains, you will have received a domain admin password in the confirmation e-mail. Using this, log in at http://access.enom.com entering newdomain.com and the domain admin password. Once there, click "edit" in the name servers section. Make sure the name servers are set to "custom" and enter the name servers listed above.)

3.) Create a new web directory. This can be done via FTP and shell as well, but for this tutorial, we will use file manager as it doesn't require any additional software. Log into your site manager at primarydomain.com/manager. Once there, click on File Manager under Utilities on the left hand menu. This will ask you to log in with your site manager username and password again. Now that you are in, it should show a current directory of /var/www/html. Click the "up one dir" link once and you should then be in a current directory of /var/www This is where we want to create the new directory.
Using the "Create Directory option near the top of the file manager screen, enter in your domain name as the directory name, newdomain.com (all lowercase) and click create directory. You should now see a new directory in /var/www/ called newdomain.com This is where you will upload files for your new website: /var/www/newdomain.com You can now close file manager.

Note on Step 3: this is assuming that you want the new domain to host a separate website from your primary domain. If you want the new domain to pull up the same content as the primary domain, skip this step and use the default directory instead of a custom directory in step 4.

4.) Add the domain to your site manager. In the site manager, click on "Domains" near the bottom of the left hand menu. On this page click "Add Domain" near the right hand side. This will open up a dialogue box that should be filled in as follows:
Domain name: newdomain.com
-(Some people want to put www.newdomain.com here. DO NOT do this.
It will cause odd DNS issues especially with email).
Use Local Mail Server: Check this box if WestHost should handle e-mail for this domain.
Web Directory: Select Custom directory, remove the default and enter in:
/var/www/newdomain.com (all lowercase)
Click Finish.

The new domain has now been added to your account. Upload your new website to /var/www/newdomain.com and after normal DNS propagation (3-24 hours) your new site should be live, though you can start uploading the new content before propagation finishes.

10-23-2010, 04:03 PM
Thanks for the tutorial Scott. One quick question. I can't remember of the top of my head if the /var/www directory has the same settings in the httpd.conf file in regards to the use of .htacces files and cgi scripts. If it does not might it be a good idea to add the information needed to make that change so the new domain well react in the same way as the primary domain does into this thread?

10-23-2010, 04:05 PM
P.S. Just in case someone finds this thread and is looking to make the changes to httpd.conf (still not sure this is needed for Scott's set up) you can find them here. http://wildjokerdesign.net/faq/how-do-i-enable-htaccess-files-secondary-domain

10-23-2010, 04:10 PM
Thanks for pointing that out wildjoker. It is true that the permissions are different. The link you gave is perfect for making that change to allow .htaccess file premissions or other options. For cig-bin stuff, either copy the symlink from the html directory and share a cgi-bin or maybe I can put together a post about creating a new cgi-bin with the necessary Options if there is any interest. cgi-bin is typically a more advanced option that most users don't need, so I won't put it in as part of this post.