Re: [users@httpd] apache 2.4 virtualhosts

2012-03-16 Thread Eric Covener
On Fri, Mar 16, 2012 at 4:08 AM, Brett @Google brett.maxfi...@gmail.com wrote:
 VirtualHost *:80
 # This first-listed virtual host is also the default for *:80
 ServerName www.example.com
 ServerAlias example.com *.example.com
 DocumentRoot /www/domain
 /VirtualHost

 VirtualHost *:80
 ServerName other.example.com
 DocumentRoot /www/otherdomain
 /VirtualHost

 Above is not correct, as other.example.com would never have a chance
 to match in the second virtualhost, only the first virtualhost because
 of the wildcard which matches anything that ends in *.example.com, it
 never will even examine the next virtualhost.

I'm surprised to find that serveralias seems to cover up a match for
ServerName, but this isn't a difference in 2.4

-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org



RE: [users@httpd] Apache + Tomcat Load Balancing

2012-03-16 Thread Kashif Rahman
Actually we are load balancing tomcat too.

 

Thank you,

 

Best Regards,


Kashif Rahman

Principal SCM Engineer

Description: vopium_signature_logo

 

Vopium A/S | Office# 2, 7th Floor, Shaheen Complex | 38 Abbot Road

Lahore | Pakistan | t + 92 42 6316491 | f + 92 42 6316492

 

Description: imagesCAV9FMB1 + 92 334 9771227 | Description: imagesCAXWPPLS
kashif_r | w  www.vopium.com http://www.vopium.com/ 

 

From: Anam Ali Khan [mailto:anamalik...@yahoo.com] 
Sent: Thursday, March 15, 2012 10:16 PM
To: users@httpd.apache.org
Subject: Re: [users@httpd] Apache + Tomcat Load Balancing

 

Why are you defining mod_proxy_balancer directives in WEB1  WEB2. You only
need to configure these in Apache Load Balancer machine.

 

Correct me if i am wrong.

 

-Anam

 

  _  

From: Anam Ali Khan anamalik...@yahoo.com
To: users@httpd.apache.org users@httpd.apache.org 
Sent: Thursday, 15 March 2012, 22:13
Subject: Re: [users@httpd] Apache + Tomcat Load Balancing

 

Do not use session replication/sharing, use session stickiness instead.

 

-Anam

 

  _  

From: Igor Cicimov icici...@gmail.com
To: users@httpd.apache.org 
Sent: Wednesday, 14 March 2012, 14:48
Subject: RE: [users@httpd] Apache + Tomcat Load Balancing

 

What is in apache log file, any proxy errors? I would do some extra logging
if i was you as given in the below link:

http://httpd.apache.org/docs/2.2/mod/mod_proxy_balancer.html#stickyness_trou
bleshooting

On Mar 14, 2012 8:28 PM, Kashif Rahman kashif.rah...@vopium.com wrote:

Yes I have that same in server.xml on both tomcats.

 

Thank you,

 

Best Regards,

Kashif Rahman

 

From: Igor Cicimov [mailto:icici...@gmail.com] 
Sent: Wednesday, March 14, 2012 2:21 PM
To: users@httpd.apache.org
Subject: RE: [users@httpd] Apache + Tomcat Load Balancing

 

Does the route parameters in the apache balancer tomcat1 and tomcat2 match
the jvmRoute value in the tomcat connectors?

On Mar 12, 2012 9:19 PM, Kashif Rahman kashif.rah...@vopium.com wrote:

Here what I have used :

 

==

 

ProxyRequests Off

Proxy *

  AddDefaultCharset Off

  Order deny,allow

  Allow from all

/Proxy

ProxyPass /balancer-manager !

ProxyPass /examples balancer://qawebcluster/examples

ProxyPassReverse /examples balancer://qawebcluster/examples

ProxyPass /kashif/admin ajp://x.x.x.x:18009/kashif/admin

ProxyPassReverse /kashif/admin ajp://x.x.x.x:18009/kashif/admin

 

#ProxyPass /kashif balancer://qawebcluster/kashif
stickysession=JSESSIONID|jsessionid

#ProxyPassReverse /kashif balancer://qawebcluster/kashif
stickysession=JSESSIONID|jsessionid

ProxyPass /kashif balancer://qawebcluster/kashif

ProxyPassReverse /kashif balancer://qawebcluster/kashif

ProxyPass /k balancer://qawebcluster/k
stickysession=JSESSIONID|jsessionid

ProxyPassReverse /k balancer://qawebcluster/k
stickysession=JSESSIONID|jsessionid

   Proxy balancer://qawebcluster

  BalancerMember ajp://127.0.0.1:8009 route=tomcat1 disablereuse=On

  BalancerMember ajp://x.x.x.x:8009 route=tomcat2 disablereuse=On

  ProxySet lbmethod=byrequests

/Proxy

 

ProxyPreserveHost Off

ProxyStatus On

 

==

We have this config on WEB1 as WEB2 both.  3 machines involved. 1 Apache
only for load balancing and 2 machines as WEB1 and WEB2 having Apache and
tomcat on each.

 

We are using mod_proxy_ajp

 

Tomcat is clustered. Session replication works, if single Apache is handling
2 tomcat instances. When we start second Apache, tomcat session replication
stops. We want to have failover for PHP side too. 

 

Thank you,

 

Regards,

Kashif Rahman.

 

From: Igor Cicimov [mailto:icici...@gmail.com] 
Sent: Monday, March 12, 2012 2:12 PM
To: users@httpd.apache.org
Subject: RE: [users@httpd] Apache + Tomcat Load Balancing

 

You can at least tell us what OS are these servers running on? Also you said
when you put second apache something is not working so we would like to see
your apache config if you dont mind. Another thing not clear to me is tomcat
session replication. Are the tomcats clustered? If not how do they replicate
the sessions between each other?
In meantime check mod_proxy_balancer documentation as possible solution. You
can find lots of examples with sticky sessions configuration fot this module
for tomcat backends.

On Mar 12, 2012 6:19 PM, Kashif Rahman kashif.rah...@vopium.com wrote:

Thanks Anam, but we are looking at to use mod proxy for Apache/Tomcat
Communication and session persistence. Can it be done using our requirement?

 

Thank you,

 

Regards,

Kashif Rahman.

 

From: Anam Ali Khan [mailto:anamalik...@yahoo.com] 
Sent: Friday, March 09, 2012 7:44 PM
To: users@httpd.apache.org
Cc: Kashif Rahman
Subject: Re: [users@httpd] Apache + Tomcat Load Balancing

 

Hi,

 

I would recommend HAProxy as a load balancer in your PHP + JSP application

Re: [users@httpd] apache 2.4 virtualhosts

2012-03-16 Thread Eric Covener
 I'm just saying the documentation of the new matching scheme is
 deceptive, not that any code should be changed..

Operative point I'm trying to make is that there should not be a new
matching scheme -- at best only new doc that didn't get backported
since it also dropped _default_ and NameVirtualHost which we're saying
were basically unnecessary.

-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org



[users@httpd] Using HostName like ENVVAR

2012-03-16 Thread Oto BREZINA
I have multiple Virtual Host with almost same configuration they differ 
only in ServerName, ServerAdmin DocumentRoot and logfile.
DocumentRoot is composed of served files location and hostname, logs 
have servername in filename too.


To make things easier I moved common some parts into file whitch is 
included from them. I would like to move DocumentRoot and logfiles to 
include too, but I need some way to use something like ${ServerName} to 
be replaced with directive value.

Is there any way to achive this?
--
Oto BREZINA

-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org



Re: [users@httpd] Using HostName like ENVVAR

2012-03-16 Thread Tom Evans
On Fri, Mar 16, 2012 at 9:23 AM, Oto BREZINA o...@printflow.eu wrote:
 I have multiple Virtual Host with almost same configuration they differ only
 in ServerName, ServerAdmin DocumentRoot and logfile.
 DocumentRoot is composed of served files location and hostname, logs have
 servername in filename too.

 To make things easier I moved common some parts into file whitch is included
 from them. I would like to move DocumentRoot and logfiles to include too,
 but I need some way to use something like ${ServerName} to be replaced with
 directive value.
 Is there any way to achive this?

mod_macro?

http://people.apache.org/~fabien/mod_macro/

Cheers

Tom

-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org



Re: [users@httpd] 'redirect' to a single domain name

2012-03-16 Thread Tom Evans
On Fri, Mar 16, 2012 at 12:25 PM, Lester Caine les...@lsces.co.uk wrote:
 OK ... I've always set the server up so that both xxx.co.uk and
 www.xxx.co.uk are processed, but the 'quality police' are now flagging this
 as wrong, and saying that one or the other should be 'returned' by the site.
 Since some sites also have xxx.com or other options this does make sense,
 the question is how?

 I'm already using rewrite to keep the wingers happy on 'tidy url's' and that
 works well, and if I am readying things correctly 'Redirect' should handle
 the domain? But it does not seem to work. I assume that this needs to be
 handled inside the VirtualHost for it to correctly map what is listed in
 the ServerAlias to match the ServerName entry?

 What IS the politically correct way of handling this?


I know of two ways :)

1) Use two vhosts and a redirect:

VirtualHost *
  ServerName www.canonicalsitename.com
/VirtualHost

VirtualHost *
  ServerName analias.canonicalsitename.com
  ServerAlias *.canonicalsitename.com
  Redirect / http://www.canoncialsitename.com/
/VirtualHost

2) Use one vhost and a rewrite rule:

VirtualHost *
  ServerName www.canonicalsitename.com
  ServerName analias.canonicalsitename.com
  ServerAlias *.canonicalsitename.com
  RewriteCond %{HTTP_HOST} !^www.canonicalsitename.com$
  RewriteRule ^/(.*) http://www.canonicalsitename/$1 [R=301,L]
/VirtualHost

Tapped all that out, and THEN remembered that this is a FAQ:

http://httpd.apache.org/docs/2.2/rewrite/remapping.html#canonicalhost

Cheers

Tom

PS: the same Lester Caine who posts on the register boards?

-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org



Re: [users@httpd] 'redirect' to a single domain name

2012-03-16 Thread Lester Caine

Tom Evans wrote:

Tapped all that out, and THEN remembered that this is a FAQ:
http://httpd.apache.org/docs/2.2/rewrite/remapping.html#canonicalhost

TA ...


PS: the same Lester Caine who posts on the register boards?

Probably :) Don't get much time to read the news these days ...

--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org



Re: [users@httpd] 'redirect' to a single domain name

2012-03-16 Thread Lester Caine

Lester Caine wrote:

Tom Evans wrote:

Tapped all that out, and THEN remembered that this is a FAQ:
http://httpd.apache.org/docs/2.2/rewrite/remapping.html#canonicalhost

TA ...


Problem solved :)
Helps if you edit the .co.uk record rather than the .org.uk one

--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org



Re: [users@httpd] apache 2.4 virtualhosts

2012-03-16 Thread Brett @Google
On Fri, Mar 16, 2012 at 6:41 PM, Eric Covener cove...@gmail.com wrote:
 I'm just saying the documentation of the new matching scheme is
 deceptive, not that any code should be changed..

 Operative point I'm trying to make is that there should not be a new
 matching scheme -- at best only new doc that didn't get backported
 since it also dropped _default_ and NameVirtualHost which we're saying
 were basically unnecessary.

Completely agree.. In the end, my only point is that the example in
the doc is counter to
actual behavior, not proposing any code changes :)

A doc change would prevent 2.4 nu bee problems in future ..

Cheers
Brett

-- 
The only thing that interferes with my learning is my education.

Albert Einstein

-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org



[users@httpd] Different pages served depending on IP address or domain addressing

2012-03-16 Thread Prasanna Mulgaonkar
Have a strange setup behavior that I have not been able to find an 
answer to.


I have a server running Apache set up at IP address 50.X.Y.Z

I have www.mydomain.com redirected from our domain hoster to that ip 
address.



At the top level of that apache stack (/var/www/html), i have an 
index.html file that serves up correctly whether I enter 
http://www.mydomain.com or http://50.X.Y.Z into the browser address.


I have an application in a subdirectory below the html file in 
/var/www/html/app. If I say http://50.X.Y.Z/app/, the app serves up 
correctly. We have been doing that for may months now.


However, if I try http://www.mydomain.com/app/, I do not get the app–I 
get the same index.html file that is served as if the /app/ was not 
appended to the end of the mydomain.com. There are no errors or notices 
in the apache error file.



The httpd.conf file declares
ServerName www.mydomain.com:80
UseCanonicalName On

There are no vhosts set up.

What else should I look at to explain this odd behavior.

Thanks.





-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org



Re: [users@httpd] Issue with trailing slashes after rewrite

2012-03-16 Thread Igor Cicimov
First SERVER_NAME is apache internal NOT a http header sent with the
request thus will match ANY request. Use HTTP_HOST instead. You also need
to escape the dots in the host name.

Second, from the documentation:

To combine new and old query strings, use the [QSA] flag.

so by using QSA you are modifying the query string adding another foo to it
thus the result you are seeing.

Finally, your rules should look like:

RewriteCond %{HTTP_HOST} ^foo\.mydomain\.com$ http://foo.mydomain.com/
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule /(.*) /foo/$1 [L]

Igor

On Sat, Mar 17, 2012 at 1:40 AM, Nala Gnirut nala.gni...@gmail.com wrote:

 Hi all,
 in a shared hosting with no access to httpd.conf, I'm trying to redirect
 subdomains to different document root using mod_rewrite.

 I'm using this rule in a .htaccess file placed in DocumentRoot:

 # Change document root for foo.mydomain.com
 RewriteCond %{SERVER_NAME} foo.mydomain.com
 RewriteCond %{ENV:REDIRECT_STATUS} ^$
 RewriteRule .* /foo%{REQUEST_URI} [QSA,L]

 This works as expected accessing

 foo.mydomain.com
 foo.mydomain.com/
 foo.mydomain.com/bar/

 while

 foo.mydomain.com/bar

 fails as it's redirected to

 /foo/foo/bar instead of /foo/bar

 Please note that trailing slashes are automatically added to any rule but
 the ones rewritten by this rule.

 Where's my fault?

 Thanks in advance.




Re: [users@httpd] Issue with trailing slashes after rewrite

2012-03-16 Thread Igor Cicimov
RewriteCond %{HTTP_HOST} ^foo\.mydomain\.com$ http://foo.mydomain.com/
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^/(.*) /foo/$1 [L]

sorry missed the ^ above.

On Sat, Mar 17, 2012 at 1:49 PM, Igor Cicimov icici...@gmail.com wrote:

 First SERVER_NAME is apache internal NOT a http header sent with the
 request thus will match ANY request. Use HTTP_HOST instead. You also need
 to escape the dots in the host name.

 Second, from the documentation:

 To combine new and old query strings, use the [QSA] flag.

 so by using QSA you are modifying the query string adding another foo to
 it thus the result you are seeing.

 Finally, your rules should look like:

 RewriteCond %{HTTP_HOST} ^foo\.mydomain\.com$ http://foo.mydomain.com/

 RewriteCond %{ENV:REDIRECT_STATUS} ^$
 RewriteRule /(.*) /foo/$1 [L]

 Igor


 On Sat, Mar 17, 2012 at 1:40 AM, Nala Gnirut nala.gni...@gmail.comwrote:

 Hi all,
 in a shared hosting with no access to httpd.conf, I'm trying to redirect
 subdomains to different document root using mod_rewrite.

 I'm using this rule in a .htaccess file placed in DocumentRoot:

 # Change document root for foo.mydomain.com
 RewriteCond %{SERVER_NAME} foo.mydomain.com
 RewriteCond %{ENV:REDIRECT_STATUS} ^$
 RewriteRule .* /foo%{REQUEST_URI} [QSA,L]

 This works as expected accessing

 foo.mydomain.com
 foo.mydomain.com/
 foo.mydomain.com/bar/

 while

 foo.mydomain.com/bar

 fails as it's redirected to

 /foo/foo/bar instead of /foo/bar

 Please note that trailing slashes are automatically added to any rule but
 the ones rewritten by this rule.

 Where's my fault?

 Thanks in advance.





Re: [users@httpd] Apache + Tomcat Load Balancing

2012-03-16 Thread Igor Cicimov
Ok lets summarize, you have one apache load balancing the two backend
apaches which are load balancing the two backend tomcat servers. I
personally can't see any fault in this line up or your apache proxy
configuration and no reason really why would tomcat cluster session
replication stop working . Maybe has to do something with the first apache?
How is that one configured? Although the worker/tomcat name will always be
in the client cookie and doesn't really matter which one of the two apaches
will handle the request. Assuming they both have identical proxy balancer
configuration...have you checked that?

Also did you enabled the extra logging as per the link I sent? That should
help you in the troubleshooting, without knowing what exactly is in the
requests you can't do much can you? Also didn't answer if there are any
errors in the apache logs?


On Fri, Mar 16, 2012 at 7:36 PM, Kashif Rahman kashif.rah...@vopium.comwrote:

 Actually we are load balancing tomcat too.

 ** **

 Thank you,

 ** **

 Best Regards,

 *
 Kashif Rahman*

 Principal SCM Engineer

 [image: Description: vopium_signature_logo]

 ** **

 Vopium A/S | Office# 2, 7th Floor, Shaheen Complex | 38 Abbot Road

 Lahore | Pakistan |* **t* + 92 42 6316491 |* **f* + 92 42 6316492

 * *

 [image: Description: imagesCAV9FMB1] + 92 334 9771227 | [image:
 Description: imagesCAXWPPLS] kashif_r | *w*  www.vopium.com

 ** **

 *From:* Anam Ali Khan [mailto:anamalik...@yahoo.com]
 *Sent:* Thursday, March 15, 2012 10:16 PM
 *To:* users@httpd.apache.org

 *Subject:* Re: [users@httpd] Apache + Tomcat Load Balancing

 ** **

 Why are you defining mod_proxy_balancer directives in WEB1  WEB2. You
 only need to configure these in Apache Load Balancer machine.

 ** **

 Correct me if i am wrong.

 ** **

 -Anam

 ** **
 --

 *From:* Anam Ali Khan anamalik...@yahoo.com
 *To:* users@httpd.apache.org users@httpd.apache.org
 *Sent:* Thursday, 15 March 2012, 22:13
 *Subject:* Re: [users@httpd] Apache + Tomcat Load Balancing

 ** **

 Do not use session replication/sharing, use session stickiness instead.***
 *

 ** **

 -Anam

 ** **
 --

 *From:* Igor Cicimov icici...@gmail.com
 *To:* users@httpd.apache.org
 *Sent:* Wednesday, 14 March 2012, 14:48
 *Subject:* RE: [users@httpd] Apache + Tomcat Load Balancing

 ** **

 What is in apache log file, any proxy errors? I would do some extra
 logging if i was you as given in the below link:


 http://httpd.apache.org/docs/2.2/mod/mod_proxy_balancer.html#stickyness_troubleshooting
 

 On Mar 14, 2012 8:28 PM, Kashif Rahman kashif.rah...@vopium.com wrote:
 

 Yes I have that same in server.xml on both tomcats.

  

 Thank you,

  

 Best Regards,

 Kashif Rahman

  

 *From:* Igor Cicimov [mailto:icici...@gmail.com]
 *Sent:* Wednesday, March 14, 2012 2:21 PM
 *To:* users@httpd.apache.org
 *Subject:* RE: [users@httpd] Apache + Tomcat Load Balancing

  

 Does the route parameters in the apache balancer tomcat1 and tomcat2 match
 the jvmRoute value in the tomcat connectors?

 On Mar 12, 2012 9:19 PM, Kashif Rahman kashif.rah...@vopium.com wrote:
 

 Here what I have used :

  

 ==

  

 ProxyRequests Off

 Proxy *

   AddDefaultCharset Off

   Order deny,allow

   Allow from all

 /Proxy

 ProxyPass /balancer-manager !

 ProxyPass /examples balancer://qawebcluster/examples

 ProxyPassReverse /examples balancer://qawebcluster/examples

 ProxyPass /kashif/admin ajp://x.x.x.x:18009/kashif/admin

 ProxyPassReverse /kashif/admin ajp://x.x.x.x:18009/kashif/admin***
 *

  

 #ProxyPass /kashif balancer://qawebcluster/kashif
 stickysession=JSESSIONID|jsessionid

 #ProxyPassReverse /kashif balancer://qawebcluster/kashif
 stickysession=JSESSIONID|jsessionid

 ProxyPass /kashif balancer://qawebcluster/kashif

 ProxyPassReverse /kashif balancer://qawebcluster/kashif

 ProxyPass /k balancer://qawebcluster/k
 stickysession=JSESSIONID|jsessionid

 ProxyPassReverse /k balancer://qawebcluster/k
 stickysession=JSESSIONID|jsessionid

Proxy balancer://qawebcluster

   BalancerMember ajp://127.0.0.1:8009 route=tomcat1
 disablereuse=On

   BalancerMember ajp://x.x.x.x:8009 route=tomcat2 disablereuse=On*
 ***

   ProxySet lbmethod=byrequests

 /Proxy

  

 ProxyPreserveHost Off

 ProxyStatus On

  

 ==

 We have this config on WEB1 as WEB2 both.  3 machines involved. 1 Apache
 only for load balancing and 2 machines as WEB1 and WEB2 having Apache and
 tomcat on each.

  

 We are using mod_proxy_ajp

  

 Tomcat is clustered. Session