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 creating a website where users can create their own space to publish content and a feature I'd like to implement is to allow these users point their own domain to its space inside my website. So if user "John" has created:

mysite.com/john

He could point its own domain:

thesplendidjohn.com

To mysite.com/john, BUT I need to keep the original (thesplendidjohn.com); no 301 redirect nor iframes.

I've been reading a lot and I think the way to go is reverse proxy using proxypass for apache, but I still need some advice to configure all this and a basic guidelines.

Briefing:

  1. Is proxypass the way to go? How do I implement it? (any basic tutorial to guide me? I tried official website but too many concepts I don't understand)
  2. I'm totally noob to DNS configuration, and I read that there are lots of different records (A, CNAME, MX)... If I implement all this I need to write a help document so users can point their domains to my website. What will need to do domain owners? Just point to my server IP? Touch any of these registers? Do I need to touch some DNS configuration on my side to allow new domains?

I forgot to mention I'm using Apache with PHP.

share|improve this question
add comment

1 Answer

Yes you could implement this via a proxy mechanism (you could use something like varnish or squid as well as proxypass) but do you expect the proxy to rewrite the HTML it is outputing too?

Unless you are a domain registrar, there's DNS involved in this - you just need to set up your webserver to accomodate requests for 'thesplendidjohn.com' and route them accordingly.

You've not said how many users you have - one approach is to create a virtual host for every domain (send it a SIG_USR1 to handle the change). Another way would be to use a default/wildcard domain then mod_rewrite to copy the hostname into the URL path.

RewriteRule ^/(.*) /${HTTP_HOST}/$1

(may need some twiddling if you want to be able to access http://mysite.com/thesplendidjohn.com explicitly)

share|improve this answer
    
no, proxy will no need to rewrite any html. About user number, I expect a number of 200-300 using this feature, so I will need a way to automatize this to a certain level. –  clinisbut Oct 24 '11 at 12:13
    
"Unless you are a domain registrar, there's DNS involved in this", maybe you meant "there's NO DNS involved in this"? Also I don't understand the SIG_USR1 thing. –  clinisbut Oct 24 '11 at 12:15
    
SIG_USR1 means "You have to restart Apache after every httpd.conf changes" –  Lazy Badger Oct 24 '11 at 17:47
1  
Maybe mod_vhost_alias with ALIAS /john in main server will be more manageable and transparent (dual-address access, no mod_rewrite rules)? –  Lazy Badger Oct 24 '11 at 17:51
add comment

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.