-1

I have a web app where users setup their profiles. I would like to offer them the ability to use their own domains - like wordpress and other blog engines offer.

I'm wondering how these services offer this sort of feature w/o having to reload nginx/apache or update the hosting files. Is there some sort of automated way to do this?

Thank in advance.

  • This is trivial to do with either web server. Which are you deploying? – Michael Hampton Jul 10 '13 at 00:14
  • My specific problem is I have a web app and I want to allow users to map their own domain to it. Currently its hosted via Apache but I would like to use Nginx. So a use case is a user creates a profile then optionally adds their own custom domain to it. I would like to make this as simple as possible as they don't know anything about DNS. So I'm wondering if I need to use a sub domain model and have them point their A & C records to it or if there's a more graceful solution. I have seen several implementations like this via popular blog engines so was curious if there's a common pattern. – Adam O'Connor Jul 10 '13 at 02:31

2 Answers2

1

If you configure a virtual host for the wildcard domain, such as *.google.com then whenever a user in your application creates a profile you simply set their route to username.google.com.

As you've already configured the settings for the wildcard domain all subdomains are already loaded within Apache or NGINX. Therefore you won't need to reload.

dannymcc
  • 2,677
  • 10
  • 46
  • 72
  • So how would a user map their domain to user.google.com? Would they have to do it via their own dns? What I'm curious about is how are some common blog engines out there doing this w/o requiring the user to know anything about DNS. – Adam O'Connor Jul 09 '13 at 22:53
  • I think, but I could be wrong, that they simply provide instructions for the user to add an A record to their DNS. Or possibly a CNAME. – dannymcc Jul 09 '13 at 23:10
1

Check out this website for information:

http://httpd.apache.org/docs/current/mod/mod_vhost_alias.html

While I can't tell you this is what Wordpress and the like use, it certainly allows for what you are asking about.

  • Thank you - this may be what I need. Reading into it more. – Adam O'Connor Jul 09 '13 at 22:54
  • No problem. I see your question above. The user would at least have to be able to edit their external DNS records in order to be able to point to the new site. I do know that some other sites might offer bundling, where they will host and set up the domain registration so that you wouldn't have to handle it, but my best guess is that WordPress would require you to at least point the domain or perhaps give you both options. – Renegade91127 Jul 09 '13 at 23:00
  • Why was this down voted? This was exactly what he needed. – Renegade91127 Jul 10 '13 at 01:40
  • 1
    Link-only answers are discouraged, as links can die. At least a brief explanation of the solution is preferred. – Falcon Momot Jul 10 '13 at 01:48
  • Perhaps in most cases, but it is the correct answer. I'd understand a non up-vote, but a down vote for this and an up vote for the previous answer, which does not answer the question at all, doesn't make any sense. – Renegade91127 Jul 10 '13 at 13:04