How configuring a per directory and servername access

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I have a server running lots of virtualhosts, each served by a servername.

Exemple: demo1.domain.tld demo2.domain.tld ... demoX.domain.tld

I start a migration on an other server/other IP and would like make tests before production without having to create again all the servernames in DNS. I would like to have something like this:

Client goes to http://domain.tld/demo[1|2|...|X]

and Apache send the request in the right directory which are /var/www/demo[1|2|...|X]

What I did:

<VirtualHost *:80>
        ServerName cloud.domain.tld

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/$1

        <Directory /var/www/$1>
            DirectoryIndex index.php
            AllowOverride All
        </Directory>
        <Directory /var/www/$1/>
            DirectoryIndex index.php
            AllowOverride All
        </Directory>
</Virtualhost>

When I access with http://cloud.domain.tld/demo3 I get a 404 error The requested URL /demo3/ was not found on this server.

If DocumenRoot is /var/www (eg w/o $1) I receive error 404 The requested URL /login2.php was not found on this server which is the file launched by index.php in the directory served by $1

Using DNS as ServerName like

<VirtualHost *:80>
        ServerName demo1.domain.tld

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/demo1

        <Directory /var/www/demo1>
            DirectoryIndex index.php
            AllowOverride All
        </Directory>
</Virtualhost>

is working.


What am I missing to archieve my goal ?

Thanks for any hint

--
Daniel

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx




[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux