Hello,
Inspired by this post, I created the following Apache vhost to be able to run Rails and, inside /app/public, the PHP posh app.
<VirtualHost *:80> ServerName dev.example.com DocumentRoot "/home/www/projets.example.com/projets/ portfolio_immigrants/public"
SuexecUserGroup examplewww examplewww ScriptAlias /fast-cgi/ /home/www/projets.example.com/cgi-bin2/
<Directory "/home/www/projets.example.com/projets/ portfolio_immigrants/public"> Options FollowSymLinks AllowOverride None Order allow,deny Allow from all </Directory> <Proxy balancer://dev_example_com_cluster> BalancerMember http://127.0.0.1:6080 # BalancerMember http://127.0.0.1:6081 # BalancerMember http://127.0.0.1:6082 </Proxy>
ProxyPass /fast-cgi ! ProxyPass /posh !
RewriteEngine On RewriteLog "/var/log/httpd-rewrite.log" RewriteLogLevel 3 RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} -d RewriteRule ^(.+[^/])$ $1/ [R] RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} \.php RewriteRule ^(.*)$ $1 [QSA,L] RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME}/index.html -f RewriteRule ^(.*)$ $1/index.html [QSA,L] RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME}/index.php -f
RewriteRule ^(.*)$ $1/index.php [QSA,L] RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} -d RewriteRule ^(.*)[^/]$ $1/ [QSA,L] RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f RewriteRule ^/(.*)$ balancer://dev_example_com_cluster%{REQUEST_URI} [P,QSA,L] </VirtualHost>
I'm running on the server FreeBSD, Apache2, FastCGI, SuExec, Rails 2.0.2 and Mongrel.
The problem is that I can't find a way to makes mod_rewrite ignore the /fast-cgi/ ScriptAlias. Thus, when looking at the mod_rewrite log, I see the following:
init rewrite engine with requested uri /fast-cgi/php5.fcgi/posh/ index.php applying pattern '^(.+[^/])$' to uri '/fast-cgi/php5.fcgi/posh/ index.php' applying pattern '^(.*)$' to uri '/fast-cgi/php5.fcgi/posh/index.php' rewrite '/fast-cgi/php5.fcgi/posh/index.php' -> '/fast-cgi/php5.fcgi/ posh/index.php' local path result: /fast-cgi/php5.fcgi/posh/index.php prefixed with document_root to /home/www/projets.example.com/projets/ portfolio_immigrants/public/fast-cgi/php5.fcgi/posh/index.php go-ahead with /home/www/projets.example.com/projets/ portfolio_immigrants/public/fast-cgi/php5.fcgi/posh/index.php [OK]
I have tried with ProxyPass /fast-cgi ! with no success. The Rails app works fine.
TIA