Using mod_vhost_alias and DocumentRoot

Hi,

Im having a bit of trouble and am thinking that maybe im taking the wrong approach, or there is another method / hack of doing what I wish to do…

rather than filling up my httpd.conf file with a mass of virtual hosts this is what I plan to do.

==httpd.conf====8<=======

 <virtualhost *:80="">LogFormat "%v %h %l %u %t \"%r\" %>s %b" vhostv
    CustomLog logs/access_log.amserver vhostv
    ErrorLog logs/error_log.amserver
    VirtualDocumentRoot /var/server/hosts/config/hosts/%0/html
    VirtualScriptAlias /var/server/config/hosts/%0/cgi</virtualhost> 
========>8============

Then in the directory /var/server/hosts/config/hosts/ I would have the following…

domain.com -> /var/server/virtual/site1/jail/var/www

www.domain.com -> /var/server/virtual/site1/jail/var/www

So I hope people can see what im doing here…

basically Im doing this so;

1. I dont have a big virtual hosts section

2. I dont have to restart apache everytime i want to add a host, i just add the symbolic link for the host name and where i want it to point to…

3. Im doing this as im writing software so that I can manage all this stuff thru a control panel, and this method would be easier and safer than giving someone thru a control panel access to (not directly of course…) edit httpd.conf and restart apache…

SO………… THIS ALL WORKS FINE…. NO PROBLEMS AT ALL!!!

HOWEVER….. My problem is.. say I want to run php on this virtual host, for some strange reason the DocumentRoot doesnt get set by apache. Which as you can see is very annoying…

for example: say i create the file…

=======8<=======

=======>8=======

it returns…

/var/www/html

which is apache's default doc root..

Has anyone experienced this, and if they did how did they get around it… Ive been trying to nut this one out for a couple of days, seems like other people have experienced this problem as well, and some people have hacks where they mod php then recompile… i dont really want to do this for several reasons (like if i ever want to upgrade… il have to do this again…)

Thanks

0 Replies

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct