1<?xml version="1.0" encoding="ISO-8859-1"?> 2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 3<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!-- 4 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 5 This file is generated from xml source: DO NOT EDIT 6 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 7 --> 8<title>mod_proxy_scgi - Apache HTTP Server</title> 9<link href="/style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" /> 10<link href="/style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" /> 11<link href="/style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="/style/css/prettify.css" /> 12<script src="/style/scripts/prettify.min.js" type="text/javascript"> 13</script> 14 15<link href="/images/favicon.ico" rel="shortcut icon" /></head> 16<body> 17<div id="page-header"> 18<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p> 19<p class="apache">Apache HTTP Server Version 2.4</p> 20<img alt="" src="/images/feather.gif" /></div> 21<div class="up"><a href="./"><img title="<-" alt="<-" src="/images/left.gif" /></a></div> 22<div id="path"> 23<a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="../">Version 2.4</a> > <a href="./">Modules</a></div> 24<div id="page-content"> 25<div id="preamble"><h1>Apache Module mod_proxy_scgi</h1> 26<div class="toplang"> 27<p><span>Available Languages: </span><a href="/en/mod/mod_proxy_scgi.html" title="English"> en </a> | 28<a href="/fr/mod/mod_proxy_scgi.html" hreflang="fr" rel="alternate" title="Fran�ais"> fr </a></p> 29</div> 30<table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>SCGI gateway module for <code class="module"><a href="/mod/mod_proxy.html">mod_proxy</a></code></td></tr> 31<tr><th><a href="module-dict.html#Status">Status:</a></th><td>Extension</td></tr> 32<tr><th><a href="module-dict.html#ModuleIdentifier">Module�Identifier:</a></th><td>proxy_scgi_module</td></tr> 33<tr><th><a href="module-dict.html#SourceFile">Source�File:</a></th><td>mod_proxy_scgi.c</td></tr> 34<tr><th><a href="module-dict.html#Compatibility">Compatibility:</a></th><td>Available in version 2.2.14 and later</td></tr></table> 35<h3>Summary</h3> 36 37 <p>This module <em>requires</em> the service of <code class="module"><a href="/mod/mod_proxy.html">mod_proxy</a></code>. It provides support for the 38 <a href="http://python.ca/scgi/protocol.txt">SCGI protocol, version 39 1</a>.</p> 40 41 <p>Thus, in order to get the ability of handling the SCGI protocol, 42 <code class="module"><a href="/mod/mod_proxy.html">mod_proxy</a></code> and <code class="module"><a href="/mod/mod_proxy_scgi.html">mod_proxy_scgi</a></code> have to 43 be present in the server.</p> 44 45 <div class="warning"><h3>Warning</h3> 46 <p>Do not enable proxying until you have <a href="mod_proxy.html#access">secured your server</a>. Open proxy 47 servers are dangerous both to your network and to the Internet at 48 large.</p> 49 </div> 50</div> 51<div id="quickview"><h3 class="directives">Directives</h3> 52<ul id="toc"> 53<li><img alt="" src="/images/down.gif" /> <a href="#proxyscgiinternalredirect">ProxySCGIInternalRedirect</a></li> 54<li><img alt="" src="/images/down.gif" /> <a href="#proxyscgisendfile">ProxySCGISendfile</a></li> 55</ul> 56<h3>Topics</h3> 57<ul id="topics"> 58<li><img alt="" src="/images/down.gif" /> <a href="#examples">Examples</a></li> 59<li><img alt="" src="/images/down.gif" /> <a href="#env">Environment Variables</a></li> 60</ul><h3>See also</h3> 61<ul class="seealso"> 62<li><code class="module"><a href="/mod/mod_proxy.html">mod_proxy</a></code></li> 63<li><code class="module"><a href="/mod/mod_proxy_balancer.html">mod_proxy_balancer</a></code></li> 64</ul><ul class="seealso"><li><a href="#comments_section">Comments</a></li></ul></div> 65<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div> 66<div class="section"> 67<h2><a name="examples" id="examples">Examples</a></h2> 68 <p>Remember, in order to make the following examples work, you have to 69 enable <code class="module"><a href="/mod/mod_proxy.html">mod_proxy</a></code> and <code class="module"><a href="/mod/mod_proxy_scgi.html">mod_proxy_scgi</a></code>.</p> 70 71 <div class="example"><h3>Simple gateway</h3><pre class="prettyprint lang-config">ProxyPass /scgi-bin/ scgi://localhost:4000/</pre> 72</div> 73 74 <p>The balanced gateway needs <code class="module"><a href="/mod/mod_proxy_balancer.html">mod_proxy_balancer</a></code> and 75 at least one load balancer algorithm module, such as 76 <code class="module"><a href="/mod/mod_lbmethod_byrequests.html">mod_lbmethod_byrequests</a></code>, in addition to the proxy 77 modules listed above. <code class="module"><a href="/mod/mod_lbmethod_byrequests.html">mod_lbmethod_byrequests</a></code> is the 78 default, and will be used for this example configuration.</p> 79 80 <div class="example"><h3>Balanced gateway</h3><pre class="prettyprint lang-config">ProxyPass /scgi-bin/ balancer://somecluster/ 81<Proxy balancer://somecluster> 82 BalancerMember scgi://localhost:4000 83 BalancerMember scgi://localhost:4001 84</Proxy></pre> 85</div> 86</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div> 87<div class="section"> 88<h2><a name="env" id="env">Environment Variables</a></h2> 89 <p>In addition to the configuration directives that control the 90 behaviour of <code class="module"><a href="/mod/mod_proxy.html">mod_proxy</a></code>, there are a number of 91 <dfn>environment variables</dfn> that control the SCGI protocol 92 provider:</p> 93 <dl> 94 <dt>proxy-scgi-pathinfo</dt> 95 <dd>By default <code class="module"><a href="/mod/mod_proxy_scgi.html">mod_proxy_scgi</a></code> will neither create 96 nor export the <var>PATH_INFO</var> environment variable. This allows 97 the backend SCGI server to correctly determine <var>SCRIPT_NAME</var> 98 and <var>Script-URI</var> and be compliant with RFC 3875 section 3.3. 99 If instead you need <code class="module"><a href="/mod/mod_proxy_scgi.html">mod_proxy_scgi</a></code> to generate 100 a "best guess" for <var>PATH_INFO</var>, set this env-var.</dd> 101 </dl> 102</div> 103<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div> 104<div class="directive-section"><h2><a name="ProxySCGIInternalRedirect" id="ProxySCGIInternalRedirect">ProxySCGIInternalRedirect</a> <a name="proxyscgiinternalredirect" id="proxyscgiinternalredirect">Directive</a></h2> 105<table class="directive"> 106<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enable or disable internal redirect responses from the 107backend</td></tr> 108<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxySCGIInternalRedirect On|Off</code></td></tr> 109<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ProxySCGIInternalRedirect On</code></td></tr> 110<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr> 111<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr> 112<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy_scgi</td></tr> 113</table> 114 <p>The <code class="directive">ProxySCGIInternalRedirect</code> enables the backend 115 to internally redirect the gateway to a different URL. This feature 116 origins in <code class="module"><a href="/mod/mod_cgi.html">mod_cgi</a></code>, which internally redirects the 117 response, if the response status is <code>OK</code> (<code>200</code>) and 118 the response contains a <code>Location</code> header and its value starts 119 with a slash (<code>/</code>). This value is interpreted as a new local 120 URL the apache internally redirects to.</p> 121 122 <p><code class="module"><a href="/mod/mod_proxy_scgi.html">mod_proxy_scgi</a></code> does the same as 123 <code class="module"><a href="/mod/mod_cgi.html">mod_cgi</a></code> in this regard, except that you can turn off the 124 feature.</p> 125 126 <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">ProxySCGIInternalRedirect Off</pre> 127</div> 128 129</div> 130<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div> 131<div class="directive-section"><h2><a name="ProxySCGISendfile" id="ProxySCGISendfile">ProxySCGISendfile</a> <a name="proxyscgisendfile" id="proxyscgisendfile">Directive</a></h2> 132<table class="directive"> 133<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enable evaluation of <var>X-Sendfile</var> pseudo response 134header</td></tr> 135<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ProxySCGISendfile On|Off|<var>Headername</var></code></td></tr> 136<tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ProxySCGISendfile Off</code></td></tr> 137<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr> 138<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr> 139<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_proxy_scgi</td></tr> 140</table> 141 <p>The <code class="directive">ProxySCGISendfile</code> directive enables the 142 SCGI backend to let files serve directly by the gateway. This is useful 143 performance purposes -- the httpd can use <code>sendfile</code> or other 144 optimizations, which are not possible if the file comes over the backend 145 socket.</p> 146 <p>The <code class="directive">ProxySCGISendfile</code> argument determines the 147 gateway behaviour:</p> 148 <dl> 149 <dt><code>Off</code></dt> 150 <dd>No special handling takes place.</dd> 151 152 <dt><code>On</code></dt> 153 <dd>The gateway looks for a backend response header called 154 <code>X-Sendfile</code> and interprets the value as filename to serve. The 155 header is removed from the final response headers. This is equivalent to 156 <code>ProxySCGISendfile X-Sendfile</code>.</dd> 157 158 <dt>anything else</dt> 159 <dd>Similar to <code>On</code>, but instead of the hardcoded header name 160 the argument is applied as header name.</dd> 161 </dl> 162 163 <div class="example"><h3>Example</h3><pre class="prettyprint lang-config"> # Use the default header (X-Sendfile) 164 ProxySCGISendfile On 165 166 # Use a different header 167 ProxySCGISendfile X-Send-Static</pre> 168</div> 169 170</div> 171</div> 172<div class="bottomlang"> 173<p><span>Available Languages: </span><a href="/en/mod/mod_proxy_scgi.html" title="English"> en </a> | 174<a href="/fr/mod/mod_proxy_scgi.html" hreflang="fr" rel="alternate" title="Fran�ais"> fr </a></p> 175</div><div class="top"><a href="#page-header"><img src="/images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />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 again 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 Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div> 176<script type="text/javascript"><!--//--><![CDATA[//><!-- 177var comments_shortname = 'httpd'; 178var comments_identifier = 'http://httpd.apache.org/docs/2.4/mod/mod_proxy_scgi.html'; 179(function(w, d) { 180 if (w.location.hostname.toLowerCase() == "httpd.apache.org") { 181 d.write('<div id="comments_thread"><\/div>'); 182 var s = d.createElement('script'); 183 s.type = 'text/javascript'; 184 s.async = true; 185 s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier; 186 (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s); 187 } 188 else { 189 d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>'); 190 } 191})(window, document); 192//--><!]]></script></div><div id="footer"> 193<p class="apache">Copyright 2014 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p> 194<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!-- 195if (typeof(prettyPrint) !== 'undefined') { 196 prettyPrint(); 197} 198//--><!]]></script> 199</body></html>