You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Heimdall <he...@hypulse.com> on 2003/01/31 01:06:43 UTC
[users@httpd] apache2 virtual hosting with Rewrite and Fastcgi
Hi there,
First I would like to thanks apache and fastcgi teams. The php processing
speed
is damn fine with apache2.0.44 and php-4.2.3 :-).
Now I'm trying a more complex configuration with apache2.0.44 (and now
php-4.3.0)
because I would like to implement virtual hosting. I have choose the
mod_rewrite and the "separate virtual host configuration file" hint from the
apache
mod_rewrite doc, which is easy to maintain.
(i.e. : maping virtual host to a local directory. Example map file
/etc/apache/vmap :
www.toto.com /var/hosting/www.toto.com/
www.titi.com /var/hosting/www.titi.com/
www.tata.com /var/hosting/www.tata.com/
and then web pages are under each <directory>/www.)
In my httpd.conf I add the following lines for the mass hosting
(it works well for static content) :
RewriteEngine on
RewriteMap lowercase int:tolower
RewriteMap vhost txt:/etc/apache/vmap
RewriteCond ${lowercase:%{SERVER_NAME}} ^(.+)$
RewriteCond ${vhost:%1} ^(/.*)$
RewriteRule ^/(.*)$ %1/www/$1
Here is the part about fastcgi who was working fine without mod_rewrite
(the fastcgi-compiled php bin is under /usr/sbin/)
ScriptAlias /php-cgi/ "/usr/sbin/"
FastCgiIpcDir /var/apache/fastcgi
FastCgiServer /usr/sbin/php -processes 2
AddType application/x-httpd-fastphp .php .php3 .php4
Action application/x-httpd-fastphp /php-cgi/php
But both config doesn't work together because mod_rewrite is executed after
aliases or something and .php files are then not found, as if the
ScriptAlias was
ignored. (i.e. : http://www.toto.com/info.php gives :
init rewrite engine with requested uri /info.php
rewrite /info.php -> /var/hosting/www.toto.com/www/info.php
local path result: /var/hosting/www.toto.com/www/info.php
go-ahead with /var/hosting/www.toto.com/www/info.php [OK]
init rewrite engine with requested uri /php-cgi/php/info.php
rewrite /php-cgi/php/info.php ->
/var/hosting/www.toto.com/www/php-cgi/php/info.php
local path result: /var/hosting/www.toto.com/www/php-cgi/php/info.php
go-ahead with /var/hosting/www.toto.com/www/php-cgi/php/info.php [OK] )
After some hours tweaking both mods, I'm lost... I can't make Rewrite or
Fastcgi processing php files through this config ...
If someone has an idea about that please help :-)
Thx a lot
--
Heimdall
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] apache2 virtual hosting with Rewrite and Fastcgi
Posted by Sander Holthaus - Orange XL <in...@orangexl.com>.
I tried the same, but but found it causes too much trouble with other
configuration directives (guess you have the same prob). Also, until 2.0.4x,
the rewrite-module was quite buggy too.
But why use the rewrite-engine to do this? Looked at
http://httpd.apache.org/docs-2.0/mod/mod_vhost_alias.html yet?
----- Original Message -----
From: "Heimdall" <he...@hypulse.com>
To: <us...@httpd.apache.org>
Sent: Friday, January 31, 2003 1:06 AM
Subject: [users@httpd] apache2 virtual hosting with Rewrite and Fastcgi
> Hi there,
>
> First I would like to thanks apache and fastcgi teams. The php processing
> speed
> is damn fine with apache2.0.44 and php-4.2.3 :-).
>
> Now I'm trying a more complex configuration with apache2.0.44 (and now
> php-4.3.0)
> because I would like to implement virtual hosting. I have choose the
> mod_rewrite and the "separate virtual host configuration file" hint from
the
> apache
> mod_rewrite doc, which is easy to maintain.
> (i.e. : maping virtual host to a local directory. Example map file
> /etc/apache/vmap :
> www.toto.com /var/hosting/www.toto.com/
> www.titi.com /var/hosting/www.titi.com/
> www.tata.com /var/hosting/www.tata.com/
> and then web pages are under each <directory>/www.)
>
> In my httpd.conf I add the following lines for the mass hosting
> (it works well for static content) :
>
> RewriteEngine on
> RewriteMap lowercase int:tolower
> RewriteMap vhost txt:/etc/apache/vmap
> RewriteCond ${lowercase:%{SERVER_NAME}} ^(.+)$
> RewriteCond ${vhost:%1} ^(/.*)$
> RewriteRule ^/(.*)$ %1/www/$1
>
> Here is the part about fastcgi who was working fine without mod_rewrite
> (the fastcgi-compiled php bin is under /usr/sbin/)
>
> ScriptAlias /php-cgi/ "/usr/sbin/"
> FastCgiIpcDir /var/apache/fastcgi
> FastCgiServer /usr/sbin/php -processes 2
> AddType application/x-httpd-fastphp .php .php3 .php4
> Action application/x-httpd-fastphp /php-cgi/php
>
> But both config doesn't work together because mod_rewrite is executed
after
> aliases or something and .php files are then not found, as if the
> ScriptAlias was
> ignored. (i.e. : http://www.toto.com/info.php gives :
> init rewrite engine with requested uri /info.php
> rewrite /info.php -> /var/hosting/www.toto.com/www/info.php
> local path result: /var/hosting/www.toto.com/www/info.php
> go-ahead with /var/hosting/www.toto.com/www/info.php [OK]
> init rewrite engine with requested uri /php-cgi/php/info.php
> rewrite /php-cgi/php/info.php ->
> /var/hosting/www.toto.com/www/php-cgi/php/info.php
> local path result: /var/hosting/www.toto.com/www/php-cgi/php/info.php
> go-ahead with /var/hosting/www.toto.com/www/php-cgi/php/info.php [OK] )
>
> After some hours tweaking both mods, I'm lost... I can't make Rewrite or
> Fastcgi processing php files through this config ...
>
> If someone has an idea about that please help :-)
> Thx a lot
>
> --
> Heimdall
>
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> " from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] apache2 virtual hosting with Rewrite and Fastcgi
Posted by Jurgen <ap...@squarehosting.com>.
Hi,
I don't know anything about a buggy mod_rewrite, but if you rewrite /php-cgi/ then the script alias won't work anymore.
So you should exclude /php-cgi/ and enter another RewriteCond like
RewriteCond %{REQUEST_URI} !^/php-cgi/
I guess it would be also a bit more elegant to skip the other 2 RewriteCond, because they are not really RewriteCond's, because they match everything
Instead you could use
RewriteRule ^/(.*)$ ${vhost:${lowercase:%{SERVER_NAME}}}/www/$1
Jurgen
On Fri, 31 Jan 2003 01:06:43 +0100
"Heimdall" <he...@hypulse.com> wrote:
> Hi there,
>
> First I would like to thanks apache and fastcgi teams. The php processing
> speed
> is damn fine with apache2.0.44 and php-4.2.3 :-).
>
> Now I'm trying a more complex configuration with apache2.0.44 (and now
> php-4.3.0)
> because I would like to implement virtual hosting. I have choose the
> mod_rewrite and the "separate virtual host configuration file" hint from the
> apache
> mod_rewrite doc, which is easy to maintain.
> (i.e. : maping virtual host to a local directory. Example map file
> /etc/apache/vmap :
> www.toto.com /var/hosting/www.toto.com/
> www.titi.com /var/hosting/www.titi.com/
> www.tata.com /var/hosting/www.tata.com/
> and then web pages are under each <directory>/www.)
>
> In my httpd.conf I add the following lines for the mass hosting
> (it works well for static content) :
>
> RewriteEngine on
> RewriteMap lowercase int:tolower
> RewriteMap vhost txt:/etc/apache/vmap
> RewriteCond ${lowercase:%{SERVER_NAME}} ^(.+)$
> RewriteCond ${vhost:%1} ^(/.*)$
> RewriteRule ^/(.*)$ %1/www/$1
>
> Here is the part about fastcgi who was working fine without mod_rewrite
> (the fastcgi-compiled php bin is under /usr/sbin/)
>
> ScriptAlias /php-cgi/ "/usr/sbin/"
> FastCgiIpcDir /var/apache/fastcgi
> FastCgiServer /usr/sbin/php -processes 2
> AddType application/x-httpd-fastphp .php .php3 .php4
> Action application/x-httpd-fastphp /php-cgi/php
>
> But both config doesn't work together because mod_rewrite is executed after
> aliases or something and .php files are then not found, as if the
> ScriptAlias was
> ignored. (i.e. : http://www.toto.com/info.php gives :
> init rewrite engine with requested uri /info.php
> rewrite /info.php -> /var/hosting/www.toto.com/www/info.php
> local path result: /var/hosting/www.toto.com/www/info.php
> go-ahead with /var/hosting/www.toto.com/www/info.php [OK]
> init rewrite engine with requested uri /php-cgi/php/info.php
> rewrite /php-cgi/php/info.php ->
> /var/hosting/www.toto.com/www/php-cgi/php/info.php
> local path result: /var/hosting/www.toto.com/www/php-cgi/php/info.php
> go-ahead with /var/hosting/www.toto.com/www/php-cgi/php/info.php [OK] )
>
> After some hours tweaking both mods, I'm lost... I can't make Rewrite or
> Fastcgi processing php files through this config ...
>
> If someone has an idea about that please help :-)
> Thx a lot
>
> --
> Heimdall
>
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> " from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org