virtualpsm
-
Posts
2 -
Joined
-
Last visited
Never
Posts posted by virtualpsm
-
-
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!
Dynamic VirtualHost Problem - reading from DB or Flat File?
in Apache HTTP Server
Posted
Basically, I want to be able to add subdomains & domains to Apache 2.0 dynamically, but I can't figure out how to get them into my VirtualHost.
I understand apache can dynamically construct vhosts based on the directory structure, but the problem I see there is that I want each site to have the same code base/document root, not read from their individual directories.
I read on apache's docs that mod_rewrite can read in an external file, which may be a possibility. I would just need to write the corresponding PHP script that would append to or delete from that file when hosts are added/deleted.
Can anyone help me here? The ideal for me would be to have a directory of flat files (one for each vhost) to read with the vhost information or construct it from my SQL database. I'm open to all ideas.
Thanks in advance.