View Full Version : Creating Multiple Subdomains

09-30-2006, 06:32 AM

I am looking to create multiple subdomains (lots of them).

To speed things up I have created all the subdirectories using mkdir at the command line using putty.

Does anyone know if there is a way I can create the subdomain entries at the command line as well instead of using the control panel which will be very slow.

Thanks in advance

09-30-2006, 06:58 AM
Yes you could edit your httpd.conf file to add them manually then resart Apache. If you add one subdomain via the Site Manager and then take a look at httpd.conf you will see what needs to be added. They are added at the bottom of the file. Do take care when you manually edit httpd.conf since if you make a mistake it will keep Apache from restarting. Make a back up. :) Location of httpd.conf is /ect/httpd/conf/httpd.conf and can be edited via SSH with pico or vi.

09-30-2006, 07:02 AM
Basics of what is added for a sub domain via Site Manager are:

<VirtualHost *>
ServerName sub.domain.com
ServerAlias www.sub.domain.com
DocumentRoot /path/to/directory

If the subdomain directory is outside of /var/www/html then you may have to add other <Directory> tags if you find there are some things that do not work. Reviewing the set up of your main domain further up in the file will reveal information in such case.

09-30-2006, 10:11 AM
Great. Thanks

10-01-2006, 07:37 AM
Tried it but it didn't work....

I added some subdomains through the Control Panel and then checked httpd.conf for the correct syntax.

The domain that was added through the Control Panel was

travel.helpandadviceonline.com (http://travel.helpandadviceonline.com)

which added this to the httpd.conf file

<VirtualHost *>
ServerName travel.helpandadviceonline.com
ServerAlias www.travel.helpandadviceonline.com
DocumentRoot /var/www/vhosts/helpandadviceonline/subdomains/travel

I then added this set of lines manually and restarted the server.

<VirtualHost *>
ServerName vacation.helpandadviceonline.com
ServerAlias www.vacation.helpandadviceonline.com
DocumentRoot /var/www/vhosts/helpandadviceonline/subdomains/vacation

but the subdomain vacation.helpandadviceonline.com (http://vacation.helpandadviceonline.com) retutrns an error and this domain does not show up in the Control Panel.

Is there a rebuild needed elsewhere that I have missed as the new subdomian does not work and the Control Panel doesn't see it?


10-01-2006, 05:17 PM
I didn't think there was anything else needed but then have not tried createing a subdomain by adding it manually only adding to what was added via the Site Manager. What error did you get I am getting a white screen.

10-01-2006, 10:07 PM
Firefox gives "Problem Loading Page" and IE gives "Cannot Find Server"

10-02-2006, 07:52 AM
I did a bit of testing and found out that there is one other (at least) file that is modified when you add a sub domain. There is an entry made to /var/named/db.yourdomain.com but unfortunately we do not have write access to this file since it is owned by root. It looks like the only way that you are going to be able to add sub domains is via the Site Manager. Sorry for the bad new. :(

10-02-2006, 01:15 PM
OK, thanks. I'll have to do it the hard way.