Zend FR

Consultez la FAQ sur le ZF avant de poster une question

Vous n'êtes pas identifié.

#1 26-11-2012 15:53:14

basillic
Nouveau membre
Date d'inscription: 26-11-2012
Messages: 2

Plusieurs applications ZF1 sur le même virtualhost

Bonjour,

Je souhaite faire tourner plusieurs application ZF1 à partir d'un même virtualhost Apache2. La distinction entre les applications se fera donc à partir des chemins.

Ainsi :
- Un virtualhost est configuré pour www.domaine.com,
- http://www.domaine.com/app1 : Application 1 tournant avec ZF1 (/var/www/testing/app1/)
- http://www.domaine.com/app2 : Application 2 tournant avec ZF1 (/var/www/testing/app2/)

Pb : jusqu'à présent, j'utilisais un VH pour chaque application ZF. Pas de pb, le DOCUMENT_ROOT pointait sur le dossier public/ et tout fonctionnait bien.

Or, on me demande de faire tourner 2 applis sur le même domaine. Et là, je bloque sur la configuration...

J'ai essayé la directive Alias pour faire pointer sur le dossier public/ :

<VirtualHost *:80>
        ServerName www.domaine.com
        ServerAdmin webmaster@localhost

        DocumentRoot /var/www/testing

        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>

        <Directory /var/www/testing>
                Options FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>

        Alias /app1 /var/www/testing/app1/public

        <Directory "/var/www/testing/app1">
                Options -All
                AllowOverride None
                Order Deny,Allow
                Deny from All
        </Directory>

        <Directory "/var/www/testing/app1/public">
                Options All -Includes -ExecCGI +MultiViews -Indexes
                AllowOverride All
                Order Deny,Allow
                Allow from All
        </Directory>

        [...]

</VirtualHost>

L'accès à l'URL http://www.domaine.com/app1/auth/login provoque l'erreur suivante

Erreur "Request exceeded the limit of 10 internal redirects due to probable configuration error".

Extrait des logs Apache :

[...initial] (2) init rewrite engine with requested uri /app1/auth/login
[...initial] (1) pass through /app1/auth/login
[...initial] (3) [perdir /var/www/testing/app1/public/] add path info postfix: /var/www/testing/app1/public/auth -> /var/www/testing/app1/public/auth/login
[...initial] (3) [perdir /var/www/testing/app1/public/] strip per-dir prefix: /var/www/testing/app1/public/auth/login -> auth/login
[...initial] (3) [perdir /var/www/testing/app1/public/] applying pattern '^.*$' to uri 'auth/login'
[...initial] (4) [perdir /var/www/testing/app1/public/] RewriteCond: input='/var/www/testing/app1/public/auth' pattern='-s' => not-matched
[...initial] (4) [perdir /var/www/testing/app1/public/] RewriteCond: input='/var/www/testing/app1/public/auth' pattern='-l' => not-matched
[...initial] (4) [perdir /var/www/testing/app1/public/] RewriteCond: input='/var/www/testing/app1/public/auth' pattern='-d' => not-matched
[...initial] (3) [perdir /var/www/testing/app1/public/] add path info postfix: /var/www/testing/app1/public/auth -> /var/www/testing/app1/public/auth/login
[...initial] (3) [perdir /var/www/testing/app1/public/] strip per-dir prefix: /var/www/testing/app1/public/auth/login -> auth/login
[...initial] (3) [perdir /var/www/testing/app1/public/] applying pattern '^.*$' to uri 'auth/login'
[...initial] (2) [perdir /var/www/testing/app1/public/] rewrite 'auth/login' -> 'index.php'
[...initial] (3) [perdir /var/www/testing/app1/public/] add per-dir prefix: index.php -> /var/www/testing/app1/public/index.php
[...initial] (2) [perdir /var/www/testing/app1/public/] forcing '/var/www/testing/app1/public/index.php' to get passed through to next API URI-to-filename handler
[...initial] (2) [perdir /var/www/testing/app1/public/] strip document_root prefix: /var/www/testing/app1/public/index.php -> /mes-comp/public/index.php
[...initial] (1) [perdir /var/www/testing/app1/public/] internal redirect with /app1/public/index.php [INTERNAL REDIRECT]
[...initial/redir#1] (2) init rewrite engine with requested uri /app1/public/index.php
[...initial/redir#1] (1) pass through /app1/public/index.php
[...initial/redir#1] (3) [perdir /var/www/testing/app1/public/] add path info postfix: /var/www/testing/app1/public/public -> /var/www/testing/app1/public/public/index.php


Dernière chose, le .htaccess présent dans app1/public/ :

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]


Si vous avez quelques pistes pour empêcher la récursion sur "public/", je suis preneur.

Hors ligne

 

#2 27-11-2012 11:02:22

basillic
Nouveau membre
Date d'inscription: 26-11-2012
Messages: 2

Re: Plusieurs applications ZF1 sur le même virtualhost

J'ai trouvé une solution sans le "Alias" dans la conf du VirtualHost :

        RewriteCond %{REQUEST_URI} ^/app1.*$
        RewriteCond %{REQUEST_URI} !^/app1/public.*$
        RewriteRule ^/app1(.*)$ /var/www/testing/app1/public$1 [L]

Il est aussi possible de définir la variable APPLICATION_ENV au sein du directory de chaque application :

        <Directory "/var/www/testing/app1/public">
                [...]
                SetEnv APPLICATION_ENV "testing"
        </Directory>

J'espère que ça pourra aider d'autres personnes.

Dernière modification par basillic (27-11-2012 11:02:35)

Hors ligne

 

Pied de page des forums

Propulsé par PunBB
© Copyright 2002–2005 Rickard Andersson
Traduction par punbb.fr

Graphisme réalisé par l'agence Rodolphe Eveilleau
Développement par Kitpages