i would like to ask if it's possible to use FastCgiExternalServer directive with mod_rewrite rules which makes subdomains automaticaly by addind dir to DocumentRoot.

In the past we used mod_php, but now we would like to switch to PHP-FPM with FastCGI

There is configuration:

<VirtualHost *:80>
    ServerAdmin servers@test.tld
    ServerName test.tld
    ServerAlias  *.test.tld

    DocumentRoot /data/www/test.tld

    SuexecUserGroup test_tld webgroup

    FastCgiExternalServer /data/www/test.tld/php5.external -socket /data/www/.socks/test_tld.sock -idle-timeout 60

    <IfModule mod_rewrite.c>
            RewriteEngine  on
            RewriteCond %{HTTP_HOST}  ^(www\.)?(.*)\.([^\.]*)\.([^\.]*)$ [NC]
            RewriteRule ^(.*)$ /%2/$1 [L]
    </IfModule>

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

    <Directory /data/www/test.cz/>
            Options -Indexes +FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            Allow from all
    </Directory>

    CustomLog /data/www/test.tld/access_log combined
    ErrorLog /data/www/test.tld/error_log
</VirtualHost>

LoadModule fastcgi_module modules/mod_fastcgi.so

<IfModule mod_fastcgi.c>
    AddHandler php5-fcgi .php
    Action php5-fcgi /php5.external

    DirectoryIndex index.php index.php5

    <Location "/php5.external">
            Options ExecCGI
            Order Deny,Allow
            Deny from All
            Allow from env=REDIRECT_STATUS
    </Location>
</IfModule>

At this point rewriting for subdomains works great, static pages are displayed too!

But when i enter request to example subdomain: example.test.tld, dynamic .php content forwarded throw created fake handler php5.external doesn't use the structure /data/www/test.tld/php5.external (definded in FastCgiExternalServer), but /data/www/test.tld/example/php5.external, where there is no fake handler file php5.external.

Any ideas? Thanks a lot.

link|improve this question
feedback

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
or
required, but never shown

Browse other questions tagged or ask your own question.