Jump to content


Photo

dynamic virtual hosts scenario


  • Please log in to reply
No replies to this topic

#1 virtualpsm

virtualpsm
  • Members
  • Pip
  • Newbie
  • 2 posts

Posted 23 September 2006 - 04:03 PM

Hello all -

Here's the scenario, running PHP5 and Apache 2.x on Fedora5

I am making it possible for new subdomains or domains to be added to my server through a PHP web utility.  I have DNS figured out (using powerdns with mysql), but now I am not sure how to configure Apache w/o modifying the .conf file each time and reloading (doesn't even seen possible with PHP).

I have done some research into dynamic virtualhosts, but the problem is that I want to run the SAME php script DocumentRoot directory for each virtuahost, but have the virtualhosts dynamically loaded either by a directory structure, or even a file that is read into Apache that I can use PHP to append to or delete from.

In other words, I want all of the following to work:
------
  http://www.someoneelesedomain.com/
runs scripts located in
  /www/masterphpscript
------
  http://site1.mydomain.com/
runs scripts located in
  /www/masterphpscript
------
  http://site2.mydomain.com
runs scripts located in
  /www/masterphpscript

I don't think setting up a regular <VirtualHost> with wildcards will work as
a) I want to support TLDs that I have no clue what they'll be (i.e. someoneelsesdomain.tld or someone.elses.domain.tld)
b) I have special subdoms (i.e. mydomain.com, www.mydomain.com) that I DON'T want to run the master php script, I want them to access a totally different DocumentRoot.

So I can't very well set up a virtualhost which is ServerName *.* can I?

----------------------------

Now, here's some extra credit:

Currently for individual sites I am storing files in a mysql database.  However, in the future I may want to move them out to regular chmod777 folder on the server.  So... in that case, how could I accomplish the following:
------
  http://www.someoneelesedomain.com/
runs scripts located in
  /www/masterphpscript
access files stored in
  /www/vhosts/someoneelsesdomain.com/files/

------
  http://site1.mydomain.com/
runs scripts located in
  /www/masterphpscript
access files stored in
  /www/vhosts/site1.mydomain.com/files/

------
  http://site2.mydomain.com
runs scripts located in
  /www/masterphpscript
access files stored in
  /www/vhosts/site2.mydomain.com/files/

Thanks in advance! 




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users