How to add subdomains with Apache and GoDaddy.

by Tyler Perroux on August 10, 2009

After much headache and very long hours, I finally figured out how to do this.

I had everything right except for my DNS settings. In order to make a subdomain, you should create another site with Apache.

Create the file /etc/apache2/sites-available/yourSiteName

Fill the file with

<VirtualHost *:80>
 ServerName sub.domain.com
 ServerAdmin webmaster@domain.com
 DocumentRoot /your/doc/root/for/subdomain
 <Directory />
 Options FollowSymLinks
 AllowOverride All
 </Directory>
 <Directory /your/doc/root/for/subdomain>
 Options Indexes FollowSymLinks MultiViews
 AllowOverride All
 Order allow,deny
 allow from all
 </Directory>

 ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
 <Directory "/usr/lib/cgi-bin">
 AllowOverride None
 Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
 Order allow,deny
 Allow from all
 </Directory>

 ErrorLog /var/log/apache2/error.log

 # Possible values include: debug, info, notice, warn, error, crit,
 # alert, emerg.
 LogLevel warn
 CustomLog /var/log/apache2/access.log combined

</VirtualHost>

Now in your *nix command line run

a2ensite yourSiteName

and restart apache

/etc/inti.d/apache2 restart

Now you still will not be able to see this.

You will need to create a wildcard A record with whatever DNS you use(I have GoDaddy).

Type: *  value: IP.ADDR(replace with your server IP) TTL: 1 hour

Now you can replace Type: with your subdomain name if you wish, but It’s easier just to do this if you have large amount of subdomains.

That’s it.

–Tyler Perroux

  • Share/Bookmark

This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

{ 1 trackback }

Setup a Home Based Web Server Using Linux | Tyler Perroux
December 18, 2009 at 1:32 pm

{ 1 comment… read it below or add one }

jay @ work at home August 22, 2009 at 11:09 pm

thanks for this trick. Now I finally can implement this quickly, thanks a lot.

Reply

Leave a Comment

Previous post:

Next post: