You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Steve Redlich <ap...@redlicheng.com> on 2005/01/29 20:31:22 UTC

[users@httpd] Mod_Rewrite and Virtual Hosting.

Hi,

I've been using mod_vhost_alias successfully with
VirtualDocumentRoot /var/httpd/websites/%-2.0.%-1.0

However, I want to switch to using a "separate virtual host configuration file"
using mod_rewrite as described at the bottom of
http://httpd.apache.org/docs/vhosts/mass.html

The vhost map shown:
www.customer-1.com  /www/customers/1
www.customer-2.com  /www/customers/2
...

I want to make the "www." part of the URL optional.

I've setup my vhost map (and document directories) as shown:
domain1.com	/var/httpd/user1/domain1.com
domain2.net	/var/httpd/user1/domain2.net
domain3.com	/var/httpd/user2/domain3.com
domain4.org	/var/httpd/user2/domain4.org
doamin5.com	/var/httpd/user3/domain5.com
...

I want to modify the rules in the given example to remove the
www. if present from the SERVER_HOST  before looking up the
root directory (for the given domain) in the map

unlike the example, I have one cgi-bin directory on my server so I do not
need to map it per domain.

Below is my attempt at writing the modified configuration (in httpd.conf)
I would appreciate some comments on my modifications before trying it out
as I'm new to mod_rewrite.

Thanks,
Steve

--
RewriteEngine on

RewriteMap   lowercase  int:tolower

# define the map file
RewriteMap   vhost      txt:/etc/apache/vhost.map

# deal with aliases as in example
RewriteCond  %{REQUEST_URI}               !^/icons/
RewriteCond  %{REQUEST_URI}               !^/cgi-bin/

# handle leading www separately
RewriteCond  ${lowercase:%{SERVER_NAME}}  !^www\.

RewriteCond  ${lowercase:%{SERVER_NAME}}  ^(.+)$
# this does the file-based remap
RewriteCond  ${vhost:%1}                  ^(/.*)$
RewriteRule  ^/(.*)$                      %1/$1

# remove the www
RewriteCond  ${lowercase:%{SERVER_NAME}}  ^www\.(.+)$
RewriteCond  ${vhost:%1}                  ^(/.*)$
RewriteRule  ^/(.*)$                      %1/$1
--

Here is the original recipe from http://httpd.apache.org/docs/vhosts/mass.html

RewriteEngine on

RewriteMap   lowercase  int:tolower

# define the map file
RewriteMap   vhost      txt:/www/conf/vhost.map

# deal with aliases as above
RewriteCond  %{REQUEST_URI}               !^/icons/
RewriteCond  %{REQUEST_URI}               !^/cgi-bin/
RewriteCond  ${lowercase:%{SERVER_NAME}}  ^(.+)$
# this does the file-based remap
RewriteCond  ${vhost:%1}                  ^(/.*)$
RewriteRule  ^/(.*)$                      %1/docs/$1

RewriteCond  %{REQUEST_URI}               ^/cgi-bin/
RewriteCond  ${lowercase:%{SERVER_NAME}}  ^(.+)$
RewriteCond  ${vhost:%1}                  ^(/.*)$
RewriteRule  ^/(.*)$                      %1/cgi-bin/$1

---------------------------------------------------------------------
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] Using php with Apache 2

Posted by Tim Burden <ti...@burden.ca>.
Yep, been using PHP in Apache 2.x for years now. I think the problem is that
some PHP extensions are not guaranteed thread safe. So you either don't use
those extensions or you don't use the threaded MPMs (i.e. stick with
prefork)
http://httpd.apache.org/docs-2.0/mpm.html

The default Apache/PHP install from Fedora RPMs is Apache 2

----- Original Message ----- 
From: "Mike Muratet" <mu...@eng.uah.edu>
To: <us...@httpd.apache.org>
Sent: Saturday, January 29, 2005 5:10 PM
Subject: [users@httpd] Using php with Apache 2


> Greetings
>
> The installation instructions for php contain the warning to not use php
> with Apache 2.0_x in a production environment and mentions information
> from FAQ that follows and explains why. I've read several times, and I
> can't make sense of it. I'm not sure what 'production' means in this
> context, but it seems to me that most people wouldn't build a website
> unless they intended to use it for something.
>
> So, I'm asking the list: is it safe to use php with Apache 2?
>
> Thanks
>
> Mike
>
>
>
> ---------------------------------------------------------------------
> 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


[users@httpd] mod_auth_mysql.c

Posted by Mike Muratet <mu...@eng.uah.edu>.
Greetings

Does anyone know where to get the most recent (or any version compatible
with Apache 2.54) of mod_auth_mysql.c?

Thanks

Mike



---------------------------------------------------------------------
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] Using php with Apache 2

Posted by faisal gillani <fa...@yahoo.com>.
i am using php with apache2 since a year now , never
caused a problem to me.

i say u go for it 

take care

--- Jeff <jd...@azimapower.com> wrote:

> Mike Muratet wrote:
> > Greetings
> > 
> > The installation instructions for php contain the
> warning to not use php
> > with Apache 2.0_x in a production environment and
> mentions information
> > from FAQ that follows and explains why. I've read
> several times, and I
> > can't make sense of it. I'm not sure what
> 'production' means in this
> > context, but it seems to me that most people
> wouldn't build a website
> > unless they intended to use it for something. 
> > 
> > So, I'm asking the list: is it safe to use php
> with Apache 2?
> It depends on what modules you are compiling into
> and using with php.  The issue 
> is that some of the php modules are not thread safe.
>  Lay out what you really 
> need for that production server with php and then
> read up on the third party 
> modules you're going to compile in, and find out
> which are thread safe and which 
> are not.
> 
> I have apache2 in a production server running with
> threads and it works great, 
> but we limited the number of php modules to only
> what was needed and we knew was 
> thread safe.
> 
> You have other options as well. Compiling apache2
> without threads(prefork) or 
> using 1.3x, which is still a great HTTP server. 
> Both have their merits.
> 
> HTH
> Jeff
> > 
> > Thanks
> > 
> > Mike
> > 
> > 
> > 
> >
>
---------------------------------------------------------------------
> > 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
> 
> 


=====
*��., ��,.��*���*� Allah-hu-Akber*��., ��,.��*��*�
                    God is the Greatest



		
__________________________________ 
Do you Yahoo!? 
Meet the all-new My Yahoo! - Try it today! 
http://my.yahoo.com 
 


---------------------------------------------------------------------
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] Using php with Apache 2

Posted by Jeff <jd...@azimapower.com>.
Mike Muratet wrote:
> Greetings
> 
> The installation instructions for php contain the warning to not use php
> with Apache 2.0_x in a production environment and mentions information
> from FAQ that follows and explains why. I've read several times, and I
> can't make sense of it. I'm not sure what 'production' means in this
> context, but it seems to me that most people wouldn't build a website
> unless they intended to use it for something. 
> 
> So, I'm asking the list: is it safe to use php with Apache 2?
It depends on what modules you are compiling into and using with php.  The issue 
is that some of the php modules are not thread safe.  Lay out what you really 
need for that production server with php and then read up on the third party 
modules you're going to compile in, and find out which are thread safe and which 
are not.

I have apache2 in a production server running with threads and it works great, 
but we limited the number of php modules to only what was needed and we knew was 
thread safe.

You have other options as well. Compiling apache2 without threads(prefork) or 
using 1.3x, which is still a great HTTP server.  Both have their merits.

HTH
Jeff
> 
> Thanks
> 
> Mike
> 
> 
> 
> ---------------------------------------------------------------------
> 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


[users@httpd] Using php with Apache 2

Posted by Mike Muratet <mu...@eng.uah.edu>.
Greetings

The installation instructions for php contain the warning to not use php
with Apache 2.0_x in a production environment and mentions information
from FAQ that follows and explains why. I've read several times, and I
can't make sense of it. I'm not sure what 'production' means in this
context, but it seems to me that most people wouldn't build a website
unless they intended to use it for something. 

So, I'm asking the list: is it safe to use php with Apache 2?

Thanks

Mike



---------------------------------------------------------------------
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