Best way to setup apache for mass host plus vhost

Hi, I would like to setup properly my apache server to host about 5 sites (probably vhosted).
One of those 5 sites will hold about 500+ domains all running the same programming. The other 4 are independent.
What is the best way to approach this? I have found http://httpd.apache.org/docs/2.0/vhosts/mass.html but don't know how to setup my server in the best way for this situation. Site number 5 with the 500+ domains is a SaaS site in which no ftp access,no unique accounts, or anything like that (Though all those domains will get their own email accounts).
glabsAsked:
Who is Participating?
 
WebCricketCommented:
Using the mass approach would work if you were going to have a different document root (or application) for each of the 500+ domains or if you setup each new site with a directory that is just a symlink back to the app's actual directory. Or you can use a catchall virtual host. You add it as the last host in your httpd.conf and if a url doesn't match one of the virtual hosts before, it will match to this one on port 80 (standard http port).

<VirtualHost *:80>
    ServerAdmin webmaster@domain1.com
    DocumentRoot /www/docs/domain1.com
    ServerName domain1.com
</VirtualHost>

You would just need to
0
 
WebCricketCommented:
Do you need do have the 500+ domains each be unique or do you need them to all point to the same website? If you setup your vhost  like the following, you could add your 500+ domains to all point to the same document root

<VirtualHost example.com>
    ServerAdmin webmaster@example.com
    DocumentRoot /www/docs/example.com
    ServerName example.com

    ServerAlias example.net www.example.net www.example.com www.nextdomain.com 500+ domains
</VirtualHost>
0
 
glabsAuthor Commented:
The 500+ will all point to one document root (the same: /www/docs/500domainroot)
But there is 4 other domains that will have their own doc root /www/docs/domain1, www/docs/domain2, etc...
0
Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

 
WebCricketCommented:
You can then setup additional vHosts for each of these like: (they do not need server aliases)

<VirtualHost domain1.com>
    ServerAdmin webmaster@domain1.com
    DocumentRoot /www/docs/domain1.com
    ServerName domain1.com
</VirtualHost>


<VirtualHost domain2.com>
    ServerAdmin webmaster@domain2.com
    DocumentRoot /www/docs/domain2.com
    ServerName domain2.com
</VirtualHost>

<VirtualHost example.com>
    ServerAdmin webmaster@example.com
    DocumentRoot /www/docs/example.com
    ServerName example.com

    ServerAlias example.net www.example.net www.example.com www.nextdomain.com 500+ domains
</VirtualHost>
0
 
glabsAuthor Commented:
That seems excessive to hold 500+ domains in a vhost file? Is this the only solution?
0
 
WebCricketCommented:
500+ domains in of itself is excessive. You don't need a vhost for each of the 500+ domains, just one for each unique document root. That would mean that you will need 5 vhosts with one setup with 500+ aliases.
0
 
glabsAuthor Commented:
Correct, I guess my question is how would this effect the performance by looking up those domain aliases?
Would one of these solutions fit also?
http://httpd.apache.org/docs/2.0/vhosts/mass.html
0
 
glabsAuthor Commented:
Catchall seems the way to go i suspect.

So would it look like
<VirtualHost domain1.com>
    ServerAdmin webmaster@domain1.com
    DocumentRoot /www/docs/domain1.com
    ServerName domain1.com
</VirtualHost>


<VirtualHost domain2.com>
    ServerAdmin webmaster@domain2.com
    DocumentRoot /www/docs/domain2.com
    ServerName domain2.com
</VirtualHost>

<VirtualHost *:80>
    ServerAdmin webmaster@domain3.com
    DocumentRoot /www/docs/domain3.com
    ServerName domain3.com
</VirtualHost>
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.