I would like to setup a sub domain on my server at blah.example.com

I am able to reach my USERDIR for each user no problem at example.com/~user

I am unable to setup blah.example.com is there something more with the DNS.

What files do I need to edit. What are the important files to be noted when trying to achieve this setup.

Please and thank you.

link|improve this question

40% accept rate
1  
what are you trying to achieve? do you want a subdomain for each user (user.example.com) or one subdomain with the same user dirs (blah.example.com/~user)? – Marcel G Oct 30 '10 at 2:35
@Marcel I would like to create user.example.com :) – garbagecollector Oct 30 '10 at 15:47
feedback

2 Answers

http://httpd.apache.org/docs/2.1/en/vhosts/name-based.html The files you need to edit are depending on your OS (for example in Debian -> a2ensite http://man.he.net/man8/a2ensite / in CentOS you need to edit the httpd.conf file) You must also set a DNS Record like *.yoursite.com

link|improve this answer
feedback

this is a modified version of what you can find in the apache httpd rewrite documentation: http://httpd.apache.org/docs/current/rewrite/rewrite_guide.html#uservhosts

You'll have to put the following statements in your httpd.conf (or where ever your custom configuration options for apache are to be set, this varies from distro to distro) and make sure mod_rewrite is enabled.

RewriteEngine on
RewriteCond   %{HTTP_HOST}                  ^[^.]+\.example\.com$
RewriteRule   ^(.+)                         %{HTTP_HOST}$1      [C]
RewriteRule   ^([^.]+)\.example\.com/(.*)   /home/$1/public_html/$2

you'll also need a wildcard DNS entry (*.example.com) pointing to your server IP (or a static dns entry for each and every user which gets a subdomain).

HTH

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.