Jump to content

Archived

This topic is now archived and is closed to further replies.

virtualpsm

dynamic virtual hosts scenario

Recommended Posts

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! 

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.