Movatterモバイル変換


[0]ホーム

URL:


Modules |Directives |FAQ |Glossary |Sitemap

Apache HTTP Server Version 2.4

<-
Apache >HTTP Server >Documentation >Version 2.4 >Modules

Apache Module mod_proxy_scgi

Available Languages: en  | fr 

Description:SCGI gateway module formod_proxy
Status:Extension
Module Identifier:proxy_scgi_module
Source File:mod_proxy_scgi.c
Compatibility:Available in version 2.2.14 and later

Summary

This modulerequires the service ofmod_proxy. It provides support for theSCGI protocol, version 1.

Thus, in order to get the ability of handling the SCGI protocol,mod_proxy andmod_proxy_scgi have to be present in the server.

Warning

Do not enable proxying until you havesecured your server. Open proxy servers are dangerous both to your network and to the Internet at large.

Support Apache!

Topics

Directives

Bugfix checklist

See also

top

Examples

Remember, in order to make the following examples work, you have to enablemod_proxy andmod_proxy_scgi.

Simple gateway

ProxyPass "/scgi-bin/" "scgi://localhost:4000/"

The balanced gateway needsmod_proxy_balancer and at least one load balancer algorithm module, such asmod_lbmethod_byrequests, in addition to the proxy modules listed above.mod_lbmethod_byrequests is the default, and will be used for this example configuration.

Balanced gateway

ProxyPass "/scgi-bin/" "balancer://somecluster/"<Proxy "balancer://somecluster">    BalancerMember "scgi://localhost:4000"    BalancerMember "scgi://localhost:4001"</Proxy>
top

Environment Variables

In addition to the configuration directives that control the behaviour ofmod_proxy, anenvironment variable may also control the SCGI protocol provider:

proxy-scgi-pathinfo
By defaultmod_proxy_scgi will neither create nor export thePATH_INFO environment variable. This allows the backend SCGI server to correctly determineSCRIPT_NAME andScript-URI and be compliant with RFC 3875 section 3.3. If instead you needmod_proxy_scgi to generate a "best guess" forPATH_INFO, set this env-var. The variable must be set beforeSetEnv is effective.SetEnvIf can be used instead:SetEnvIf Request_URI . proxy-scgi-pathinfo
top

ProxySCGIInternalRedirectDirective

Description:Enable or disable internal redirect responses from thebackend
Syntax:ProxySCGIInternalRedirect On|Off|Headername
Default:ProxySCGIInternalRedirect On
Context:server config, virtual host, directory
Status:Extension
Module:mod_proxy_scgi
Compatibility:TheHeadername feature is available in version2.4.13 and later

TheProxySCGIInternalRedirect enables the backend to internally redirect the gateway to a different URL. This feature originates inmod_cgi, which internally redirects the response if the response status isOK (200) and the response contains aLocation (or configured alternate header) and its value starts with a slash (/). This value is interpreted as a new local URL that Apache httpd internally redirects to.

mod_proxy_scgi does the same asmod_cgi in this regard, except that you can turn off the feature or specify the use of a header other thanLocation.

Example

    ProxySCGIInternalRedirect Off# Django and some other frameworks will fully qualify "local URLs"# set by the application, so an alternate header must be used.<Location /django-app/>    ProxySCGIInternalRedirect X-Location</Location>
top

ProxySCGISendfileDirective

Description:Enable evaluation ofX-Sendfile pseudo responseheader
Syntax:ProxySCGISendfile On|Off|Headername
Default:ProxySCGISendfile Off
Context:server config, virtual host, directory
Status:Extension
Module:mod_proxy_scgi

TheProxySCGISendfile directive enables the SCGI backend to let files be served directly by the gateway. This is useful for performance purposes — httpd can usesendfile or other optimizations, which are not possible if the file comes over the backend socket. Additionally, the file contents are not transmitted twice.

TheProxySCGISendfile argument determines the gateway behaviour:

Off
No special handling takes place.
On
The gateway looks for a backend response header calledX-Sendfile and interprets the value as the filename to serve. The header is removed from the final response headers. This is equivalent toProxySCGISendfile X-Sendfile.
anything else
Similar toOn, but instead of the hardcoded header nameX-Sendfile, the argument is used as the header name.

Example

# Use the default header (X-Sendfile)ProxySCGISendfile On# Use a different headerProxySCGISendfile X-Send-Static

Available Languages: en  | fr 

top

Comments

Notice:
This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Libera.chat, or sent to ourmailing lists.

Copyright 2025 The Apache Software Foundation.
Licensed under theApache License, Version 2.0.

Modules |Directives |FAQ |Glossary |Sitemap


[8]ページ先頭

©2009-2025 Movatter.jp