Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

For a domain 'example.com' - what is the easiest way to set up a wildcard dns (*.example.com), hosting, and htaccess/httpd.conf/virtualhost, and script on a page so that:

how.do.i.setup.a.site.with.wildcards.like.this.example.com

or

anything.that.is.given.as.a.subdomain.for.example.com

is rendered by a page at example.com/index.html - yet keeps the wildcard subdomain in the URL bar and passes the full URL as a parameter for rendering tags in HTML?

An example tag is a Facebook comment:

{ div class="fb-comments" data-href="http://how.do.i.setup.a.site.with.wildcards.like.this.example.com" data-num-posts="2" data-width="500" }

I just opened a hosting account with spry.com and have a VPS running Ubuntu 11.04-x86-LAMP -

Essentially, what is the most straightforward way of doing this? Thanks so much.

(I originally posted this over on stackoverflow but realize its more of a serverfault question)

share|improve this question

migrated from serverfault.com Aug 30 '12 at 15:17

This question came from our site for professional system and network administrators.

1 Answer 1

The most straightforward way of doing this is to use the DNS servers from your registrar resolve all queries to the IP address of your VPS.

On your VPS you should find that apache is running and it's configuration file is /etc/apache2/sites-enabled/000-default. This default setup will respond to all http requests for any *.example.com name.

share|improve this answer

Your Answer

 
discard

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