proxy_fcgi_module

最後更新: 2019-04-18

介紹

 

"proxy_fcgi_module" module requires the service of mod_proxy.

It provides support for the FastCGI protocol.

Unlike mod_fcgid and mod_fastcgi, mod_proxy_fcgi has no provision for starting the application process;

 


Options

 

Connection reuse

Default: disable

so after a request has been completed the connection will NOT be held open by that httpd child process and won't be reused.

ProxyPass "/myapp/" "fcgi://localhost:4000/" enablereuse=on

Under HTTP/1.1 load it will likely cause the creation of up to MaxRequestWorkers connections to the FCGI backend.

Under HTTP/2 load, due to how mod_http2 is implemented, there are additional h2 worker threads that may force the creation of other backend connections.

unix sockets

 * Centos 7 Default package 2.4.6

mod_proxy_fcgi now supports unix domain sockets since 2.4.9

Proxy via Handler

<FilesMatch "\.php$">
    # Note: The only part that varies is /path/to/app.sock
    SetHandler  "proxy:fcgi://localhost:9073/"
</FilesMatch>

# Container for directives applied to proxied resources
    <Proxy "fcgi://localhost:9073/" enablereuse=on max=10>
</Proxy>

max 1...n

Maximum number of connections that will be allowed to the backend server.

The default for this limit is the number of threads per process in the active MPM.

In the Prefork MPM, this is always 1, while with other MPMs, it is controlled by the ThreadsPerChild directive.

 * 在 "mod_proxy_fcgi + php-fpm" 模式下不能用 enablereuse

Timeout

... [proxy_fcgi:error] [pid 18988] (70007)The timeout specified has expired: [client r.r.r.r:p] AH01075: Error dispatching request to ...

vi /etc/httpd/conf.modules.d/00-proxy.conf

...
Timeout 180
ProxyTimeout 180

service httpd reload

 

 

Creative Commons license icon Creative Commons license icon