View Full Version : creating subdomains or virtual hosts

07-29-2004, 04:41 AM
hi all,
good morning(well it is morning here)...i was wondering if someone knows how to create subdomains or virtual hosts?
what i mean is like..u know, allowing the user to create their website(subdomain) like http://mydomain.abcnet.com ??i am using php and apache.haven't got a clue where to start this as i totally have no idea at all. or is there an easier way like http://www.abcnet.com/mivec?(like brinksters style, www21.brinkster.com/user...)
thanking you all in advance.

07-29-2004, 05:50 AM
the second way is much easier mainly becuase it wont require you to have any further permissions...

To create a subdoman I believe you need to add to the Apache httpd.conf file, and there may be other things too... Im not sure, Ive only ever specified access ports this way.

07-29-2004, 02:24 PM
If you're running apache, it's SUPER EASY to set up user accounts in the http://www.mysite.com/~username fashion.

Simply do the following.

1) Check your umask and set it to something like 022.
2) Set the permissions on the subdirectories of /home to 750 (chmod 750 /home/*)
3) Change the group ownership on the /home sub dirs to apache (chgrp apache /home/*)
4) Make sure apache is running under the group "apache"
5) Configure the UserDir directive in the httpd.conf file to something like "public_html"
6) Make a directory in each user account called "public_html" and set the group ownership to apache with the permissions 4755 (chmod 4755 public_html)

This will take care of all your existing users on the system so they can access their site at http://www.mysite.com/~username
Note, some systems already have some of this done for you

Now, simply add a directory in the /etc/skel directory called public_html with permissions 4755 and group owner of apache. Then every time you add a user, their public_html dir will be automatically created and you'll be good to go!

Hope this helps.