Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm currently building a web application and I would like my users to have their own URLs to identify them. I could either do this using subdomains or using folders and am wondering what are the advantages and disadvantages of either one.

I really like the folder solution because my URL mapping would be fairly easy. I have read about auto-generating subdomains and one solution was to create virtual hosts and then restart my nginx. It's a solution but I would prefer not to have to restart my web server everytime a new account is created. If there are any other ways on how to do automated subdomain creation, that would be great as well!

Thanks!

share|improve this question

migrated from superuser.com Sep 6 '10 at 17:26

This question came from our site for computer enthusiasts and power users.

    
Use both. Have the directory redirect to the subdomain site. I say this because when I'm looking for the blog, I like to just type it rather than searching for the link. The only issue is that the subdomain will show up as another result in SERPs separate from the main domain. –  Rob Olmos Sep 6 '10 at 20:11

3 Answers 3

A lot of it is subjective, but I'd recommend subdomains due to security implications - it's easier for a compromised script to list the parent directory (and therefore all clients) than it is to determine all subdomains. With subdomains it's easier to move the document roots later if you need to, and easier to move them to a different server entirely (what if you get so big that you can't handle all of them on one server?)

If you have subdomain delegation, you can add different MX records for each subdomain, and you can probably get both methods working with some nifty rewrite rules.

As for server configuration without restarting see this link

share|improve this answer

One thing against using subdomains is that if you want to use https you will need a wildcard certificate.

share|improve this answer

The easiest way to use subdomains is to use a webserver that allows wildcard virtual hosts or a "default" virtual hosts. That way you won't have to "add" virtual hosts. How to do wildcard domains with nginx is explained in its documentation.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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