[users@httpd] Differences between FcgidProcessLifeTime and FcgidIdleTimeout

2014-11-11 Thread Marc Aymerich
Hi,
it is not clear to me what the differences between these two directives are.

FcgidProcessLifeTime: Idle application processes which have existed for
greater than this time will be terminated.

FcgidIdleTimeout: Application processes which have not handled a request
for this period of time will be terminated.

It's not the same? an Fcgid application will be Idle exactly the same
amount of time that it's not handling any request, right?

-- 
Marc


[users@httpd] Re: Differences between FcgidProcessLifeTime and FcgidIdleTimeout

2014-11-11 Thread Marc Aymerich
On Tue, Nov 11, 2014 at 11:16 AM, Marc Aymerich glicer...@gmail.com wrote:

 Hi,
 it is not clear to me what the differences between these two directives
 are.


Ups, I get it now


 FcgidProcessLifeTime: Idle application processes which have existed for
 greater than this time will be terminated.


This is the Idle time combine over all the process lifetime


 FcgidIdleTimeout: Application processes which have not handled a request
 for this period of time will be terminated.


And this is the Idle time after just one request :)




-- 
Marc


Re: [users@httpd] Re: ProxyPassMatch with Unix sockets

2014-04-18 Thread Marc Aymerich
On Fri, Apr 18, 2014 at 2:48 AM, Igor Cicimov icici...@gmail.com wrote:

 On 18/04/2014 10:43 AM, Igor Cicimov icici...@gmail.com wrote:


 On 18/04/2014 8:25 AM, Marc Aymerich glicer...@gmail.com wrote:
 
  On Thu, Apr 17, 2014 at 11:18 PM, Marc Aymerich glicer...@gmail.com
  wrote:
   On Wed, Apr 16, 2014 at 11:17 PM, Marc Aymerich glicer...@gmail.com
   wrote:
   Hi,
   I have a PHP-FPM web application that I want it to be accessed under
   /alias/ path. I'm trying to configure ProxyPassMatch with Unix
   sockets but it doesn't work because it passes /alias/ to the web
   app, but this path doesn't exist :(
  
   What I have so far is this:
  
   ProxyPassMatch ^/alias/(.*\.php(/.*)?)$ \
   unix:/var/run/user-fpm.sock|fcgi://localhost/home/user/webapps/app1/
  
  
   I think I got something :)
  
   if you guys like to comment on the following solution it would be
   great! (I'm kind of newbie)
  
   # Rewrite the URL before proxying
   RewriteRule ^/alias(.*\.php)$ $1 [L,PT]
  
   ProxyPassMatch ^/?(.*\.php)$
   unix:/var/run/user.sock|fcgi://127.0.0.1/home/user/webapps/app1/
  
   # Create an alias for app1 static content
   Alias /alias /home/user/webapps/app1/
 
 
  Well, actually this doesn't solve my original problem which is having
  two different php-fpm apps under the same VirtualHost.
 
  Based on the previous directives I kind of expected something like the
  following to work:
 
  LocationMatch ^/app1(.*\.php)$
  RewriteRule $1 [L,PT]
  ProxyPassMatch
  unix:/var/run/user.sock|fcgi://127.0.0.1/home/user/webapps/app1/
  /LocationMatch
 
  LocationMatch ^/app2(.*\.php)$
  RewriteRule $1 [L,PT]
  ProxyPassMatch
  unix:/var/run/user.sock|fcgi://127.0.0.1/home/user/webapps/app2/
  /LocationMatch
 
 
  But it doesn't, the RewriteRule seems to be totally ignored inside a
  LocationMatch no matter what I put there.
 
 Did you read
 http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypassmatch

 And
 http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewriterule
 Pay attention to the Context which explains where the directive should be
 used.


Thanks Igor for pointing out these documents.

I've read them carefully this morning and done some more tests, none
of them worked as I wanted to.

I have concluded that it is not possible to have multiple fcgi socket
apps on the same VirtualHost using mod proxy.

At least not by using the functionality available on current stable 2.4.9.

But I'd love someone to prove me wrong :)



Here the summary of the 3 ways I've tried:

1) The first thing is trying to pass the matched part of a URL using
ProxyPassMatch.

But the obvious way of doing this doesn't work:

ProxyPassMatch ^/alias(.*\.php)$
unix:/var/run/user.sock|fcgi://127.0.0.1/home/user/webapps/app1/$1

[Fri Apr 18 13:32:21.367171 2014] [proxy:error] [pid 29185:tid
139735912711936] (111)Connection refused: AH00957: FCGI: attempt to
connect to 127.0.0.1:8000 (*) failed
[Fri Apr 18 13:32:21.367226 2014] [proxy_fcgi:error] [pid 29185:tid
139735912711936] [client 10.0.3.64:35267] AH01079: failed to make
connection to backend: 127.0.0.1

What makes proxy_fcgi break is the ending $1. Without it no error is
reported by Apache.
However the backend server will receive the full path, a GET
/alias/info.php request.


2) Contrary on what is stated on the ProxyPassMatch documentation[1]
it seems that you can NOT use mod rewrite to do more advanced stuff.
At least not in an obvious way, something like this will not work:

RewriteRule ^/alias(.*\.php)$
unix:/var/run/user.sock|fcgi://127.0.0.1/home/user/webapps/app1$1
[P,NE]

because it gets actually rewritten as:

http://domain/unix:/var/run/user.sock|fcgi://127.0.0.1/home/user/webapps/app1/info.php


3) Also you can not use a Location block to limit the effect of a
RewriteRule+ProxyPassMatch, i.e.

LocationMatch ^/app1(.*\.php)$
RewriteRule $1 [L,PT]
ProxyPassMatch
unix:/var/run/user.sock|fcgi://127.0.0.1/home/user/webapps/app1/
/LocationMatch

According to the documentation RewriteRules have no effect inside a
Location block, but still is syntactically correct :).



[1] http://httpd.apache.org/docs/current/mod/mod_proxy.html#proxypassmatch


-- 
Marc

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



[users@httpd] Re: ProxyPassMatch with Unix sockets

2014-04-17 Thread Marc Aymerich
On Wed, Apr 16, 2014 at 11:17 PM, Marc Aymerich glicer...@gmail.com wrote:
 Hi,
 I have a PHP-FPM web application that I want it to be accessed under
 /alias/ path. I'm trying to configure ProxyPassMatch with Unix
 sockets but it doesn't work because it passes /alias/ to the web
 app, but this path doesn't exist :(

 What I have so far is this:

 ProxyPassMatch ^/alias/(.*\.php(/.*)?)$ \
 unix:/var/run/user-fpm.sock|fcgi://localhost/home/user/webapps/app1/


I think I got something :)

if you guys like to comment on the following solution it would be
great! (I'm kind of newbie)

# Rewrite the URL before proxying
RewriteRule ^/alias(.*\.php)$ $1 [L,PT]

ProxyPassMatch ^/?(.*\.php)$
unix:/var/run/user.sock|fcgi://127.0.0.1/home/user/webapps/app1/

# Create an alias for app1 static content
Alias /alias /home/user/webapps/app1/


-- 
Marc

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



[users@httpd] Re: ProxyPassMatch with Unix sockets

2014-04-17 Thread Marc Aymerich
On Thu, Apr 17, 2014 at 11:18 PM, Marc Aymerich glicer...@gmail.com wrote:
 On Wed, Apr 16, 2014 at 11:17 PM, Marc Aymerich glicer...@gmail.com wrote:
 Hi,
 I have a PHP-FPM web application that I want it to be accessed under
 /alias/ path. I'm trying to configure ProxyPassMatch with Unix
 sockets but it doesn't work because it passes /alias/ to the web
 app, but this path doesn't exist :(

 What I have so far is this:

 ProxyPassMatch ^/alias/(.*\.php(/.*)?)$ \
 unix:/var/run/user-fpm.sock|fcgi://localhost/home/user/webapps/app1/


 I think I got something :)

 if you guys like to comment on the following solution it would be
 great! (I'm kind of newbie)

 # Rewrite the URL before proxying
 RewriteRule ^/alias(.*\.php)$ $1 [L,PT]

 ProxyPassMatch ^/?(.*\.php)$
 unix:/var/run/user.sock|fcgi://127.0.0.1/home/user/webapps/app1/

 # Create an alias for app1 static content
 Alias /alias /home/user/webapps/app1/


Well, actually this doesn't solve my original problem which is having
two different php-fpm apps under the same VirtualHost.

Based on the previous directives I kind of expected something like the
following to work:

LocationMatch ^/app1(.*\.php)$
RewriteRule $1 [L,PT]
ProxyPassMatch
unix:/var/run/user.sock|fcgi://127.0.0.1/home/user/webapps/app1/
/LocationMatch

LocationMatch ^/app2(.*\.php)$
RewriteRule $1 [L,PT]
ProxyPassMatch
unix:/var/run/user.sock|fcgi://127.0.0.1/home/user/webapps/app2/
/LocationMatch


But it doesn't, the RewriteRule seems to be totally ignored inside a
LocationMatch no matter what I put there.

Any idea on how to have several fgci apps connected by sockets under
the same VirtualHost using different paths?



 --
 Marc



-- 
Marc

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



[users@httpd] ProxyPassMatch with Unix sockets

2014-04-16 Thread Marc Aymerich
Hi,
I have a PHP-FPM web application that I want it to be accessed under
/alias/ path. I'm trying to configure ProxyPassMatch with Unix
sockets but it doesn't work because it passes /alias/ to the web
app, but this path doesn't exist :(

What I have so far is this:

ProxyPassMatch ^/alias/(.*\.php(/.*)?)$ \
unix:/var/run/user-fpm.sock|fcgi://localhost/home/user/webapps/app1/


According to this documentation [1] the captured request URI ($1) is
not passed after the path. Any idea about how can I pass the correct
path to the fcgi app (without a leading /alias)?


[1] http://wiki.apache.org/httpd/PHP-FPM

Thanks!
-- 
Marc

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