EVOLUTION-MANAGER
Edit File: WSGIScriptAlias.html
<!DOCTYPE html> <!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]--> <!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]--> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>WSGIScriptAlias — mod_wsgi 4.7.1 documentation</title> <link rel="stylesheet" href="../_static/css/theme.css" type="text/css" /> <link rel="top" title="mod_wsgi 4.7.1 documentation" href="../index.html"/> <link rel="up" title="Configuration" href="../configuration.html"/> <link rel="next" title="WSGIScriptAliasMatch" href="WSGIScriptAliasMatch.html"/> <link rel="prev" title="WSGIRestrictStdout" href="WSGIRestrictStdout.html"/> <script src="../_static/js/modernizr.min.js"></script> </head> <body class="wy-body-for-nav" role="document"> <div class="wy-grid-for-nav"> <nav data-toggle="wy-nav-shift" class="wy-nav-side"> <div class="wy-side-scroll"> <div class="wy-side-nav-search"> <a href="../index.html" class="icon icon-home"> mod_wsgi </a> <div class="version"> 4.7 </div> <div role="search"> <form id="rtd-search-form" class="wy-form" action="../search.html" method="get"> <input type="text" name="q" placeholder="Search docs" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> </div> </div> <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> <ul class="current"> <li class="toctree-l1"><a class="reference internal" href="../project-status.html">Project Status</a></li> <li class="toctree-l1"><a class="reference internal" href="../security-issues.html">Security Issues</a></li> <li class="toctree-l1"><a class="reference internal" href="../getting-started.html">Getting Started</a></li> <li class="toctree-l1"><a class="reference internal" href="../requirements.html">Requirements</a></li> <li class="toctree-l1"><a class="reference internal" href="../installation.html">Installation</a></li> <li class="toctree-l1"><a class="reference internal" href="../troubleshooting.html">Troubleshooting</a></li> <li class="toctree-l1"><a class="reference internal" href="../user-guides.html">User Guides</a></li> <li class="toctree-l1 current"><a class="reference internal" href="../configuration.html">Configuration</a><ul class="current"> <li class="toctree-l2"><a class="reference internal" href="WSGIAcceptMutex.html">WSGIAcceptMutex</a></li> <li class="toctree-l2"><a class="reference internal" href="WSGIAccessScript.html">WSGIAccessScript</a></li> <li class="toctree-l2"><a class="reference internal" href="WSGIApplicationGroup.html">WSGIApplicationGroup</a></li> <li class="toctree-l2"><a class="reference internal" href="WSGIAuthGroupScript.html">WSGIAuthGroupScript</a></li> <li class="toctree-l2"><a class="reference internal" href="WSGIAuthUserScript.html">WSGIAuthUserScript</a></li> <li class="toctree-l2"><a class="reference internal" href="WSGICallableObject.html">WSGICallableObject</a></li> <li class="toctree-l2"><a class="reference internal" href="WSGICaseSensitivity.html">WSGICaseSensitivity</a></li> <li class="toctree-l2"><a class="reference internal" href="WSGIChunkedRequest.html">WSGIChunkedRequest</a></li> <li class="toctree-l2"><a class="reference internal" href="WSGIDaemonProcess.html">WSGIDaemonProcess</a></li> <li class="toctree-l2"><a class="reference internal" href="WSGIImportScript.html">WSGIImportScript</a></li> <li class="toctree-l2"><a class="reference internal" href="WSGILazyInitialization.html">WSGILazyInitialization</a></li> <li class="toctree-l2"><a class="reference internal" href="WSGIPassAuthorization.html">WSGIPassAuthorization</a></li> <li class="toctree-l2"><a class="reference internal" href="WSGIProcessGroup.html">WSGIProcessGroup</a></li> <li class="toctree-l2"><a class="reference internal" href="WSGIPythonEggs.html">WSGIPythonEggs</a></li> <li class="toctree-l2"><a class="reference internal" href="WSGIPythonHome.html">WSGIPythonHome</a></li> <li class="toctree-l2"><a class="reference internal" href="WSGIPythonOptimize.html">WSGIPythonOptimize</a></li> <li class="toctree-l2"><a class="reference internal" href="WSGIPythonPath.html">WSGIPythonPath</a></li> <li class="toctree-l2"><a class="reference internal" href="WSGIRestrictEmbedded.html">WSGIRestrictEmbedded</a></li> <li class="toctree-l2"><a class="reference internal" href="WSGIRestrictProcess.html">WSGIRestrictProcess</a></li> <li class="toctree-l2"><a class="reference internal" href="WSGIRestrictSignal.html">WSGIRestrictSignal</a></li> <li class="toctree-l2"><a class="reference internal" href="WSGIRestrictStdin.html">WSGIRestrictStdin</a></li> <li class="toctree-l2"><a class="reference internal" href="WSGIRestrictStdout.html">WSGIRestrictStdout</a></li> <li class="toctree-l2 current"><a class="current reference internal" href="">WSGIScriptAlias</a></li> <li class="toctree-l2"><a class="reference internal" href="WSGIScriptAliasMatch.html">WSGIScriptAliasMatch</a></li> <li class="toctree-l2"><a class="reference internal" href="WSGIScriptReloading.html">WSGIScriptReloading</a></li> <li class="toctree-l2"><a class="reference internal" href="WSGISocketPrefix.html">WSGISocketPrefix</a></li> </ul> </li> <li class="toctree-l1"><a class="reference internal" href="../finding-help.html">Finding Help</a></li> <li class="toctree-l1"><a class="reference internal" href="../reporting-bugs.html">Reporting Bugs</a></li> <li class="toctree-l1"><a class="reference internal" href="../contributing.html">Contributing</a></li> <li class="toctree-l1"><a class="reference internal" href="../source-code.html">Source Code</a></li> <li class="toctree-l1"><a class="reference internal" href="../release-notes.html">Release Notes</a></li> </ul> </div> </div> </nav> <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> <nav class="wy-nav-top" role="navigation" aria-label="top navigation"> <i data-toggle="wy-nav-top" class="fa fa-bars"></i> <a href="../index.html">mod_wsgi</a> </nav> <div class="wy-nav-content"> <div class="rst-content"> <div role="navigation" aria-label="breadcrumbs navigation"> <ul class="wy-breadcrumbs"> <li><a href="../index.html">Docs</a> »</li> <li><a href="../configuration.html">Configuration</a> »</li> <li>WSGIScriptAlias</li> <li class="wy-breadcrumbs-aside"> <a href="../_sources/configuration-directives/WSGIScriptAlias.txt" rel="nofollow"> View page source</a> </li> </ul> <hr/> </div> <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> <div itemprop="articleBody"> <div class="section" id="wsgiscriptalias"> <h1>WSGIScriptAlias<a class="headerlink" href="#wsgiscriptalias" title="Permalink to this headline">¶</a></h1> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Description:</th><td class="field-body">Maps a URL to a filesystem location and designates the target as a WSGI script.</td> </tr> <tr class="field-even field"><th class="field-name">Syntax:</th><td class="field-body"><tt class="docutils literal"><span class="pre">WSGIScriptAlias</span></tt> <em>URL-path file-path|directory-path</em> <tt class="docutils literal"><span class="pre">[</span></tt> <em>options</em> <tt class="docutils literal"><span class="pre">]</span></tt></td> </tr> <tr class="field-odd field"><th class="field-name">Context:</th><td class="field-body">server config, virtual host</td> </tr> </tbody> </table> <p>The WSGIScriptAlias directive behaves in the same manner as the <a class="reference external" href="http://httpd.apache.org/docs/2.2/mod/mod_alias.html#alias">Alias</a> directive, except that it additionally marks the target directory as containing WSGI scripts, or marks the specific <em>file-path</em> as a script, that should be processed by mod_wsgi’s <tt class="docutils literal"><span class="pre">wsgi-script</span></tt> handler.</p> <p>Where the target is a <em>directory-path</em>, URLs with a case-sensitive (%-decoded) path beginning with <em>URL-path</em> will be mapped to scripts contained in the indicated directory.</p> <p>For example:</p> <div class="highlight-python"><div class="highlight"><pre><span></span>WSGIScriptAlias /wsgi-scripts/ /web/wsgi-scripts/ </pre></div> </div> <p>A request for <tt class="docutils literal"><span class="pre">http://www.example.com/wsgi-scripts/name</span></tt> in this case would cause the server to run the WSGI application defined in <tt class="docutils literal"><span class="pre">/web/wsgi-scripts/name</span></tt>. This configuration is essentially equivalent to:</p> <div class="highlight-python"><div class="highlight"><pre><span></span>Alias /wsgi-scripts/ /web/wsgi-scripts/ <Location /wsgi-scripts> SetHandler wsgi-script Options +ExecCGI </Location> </pre></div> </div> <p>Where the target is a <em>file-path</em>, URLs with a case-sensitive (%-decoded) path beginning with <em>URL-path</em> will be mapped to the script defined by the <em>file-path</em>.</p> <p>For example:</p> <div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">WSGIScriptAlias</span> <span class="o">/</span><span class="n">name</span> <span class="o">/</span><span class="n">web</span><span class="o">/</span><span class="n">wsgi</span><span class="o">-</span><span class="n">scripts</span><span class="o">/</span><span class="n">name</span> </pre></div> </div> <p>A request for <tt class="docutils literal"><span class="pre">http://www.example.com/name</span></tt> in this case would cause the server to run the WSGI application defined in <tt class="docutils literal"><span class="pre">/web/wsgi-scripts/name</span></tt>.</p> <p>If possible you should avoid placing WSGI scripts under the <a class="reference external" href="http://httpd.apache.org/docs/2.2/mod/core.html#documentroot">DocumentRoot</a> in order to avoid accidentally revealing their source code if the configuration is ever changed. The WSGIScriptAlias makes this easy by mapping a URL and designating the location of any WSGI scripts at the same time. If you do choose to place your WSGI scripts in a directory already accessible to clients, do not use WSGIScriptAlias. Instead, use <a class="reference external" href="Directory">Directory</a>, <a class="reference external" href="http://httpd.apache.org/docs/2.2/mod/core.html#sethandler">SetHandler</a> and <a class="reference external" href="http://httpd.apache.org/docs/2.2/mod/core.html#options">Options</a> as in:</p> <div class="highlight-python"><div class="highlight"><pre><span></span><Directory /usr/local/apache/htdocs/wsgi-scripts> SetHandler wsgi-script Options ExecCGI </Directory> </pre></div> </div> <p>This is necessary since multiple <em>URL-paths</em> can map to the same filesystem location, potentially bypassing the WSGIScriptAlias and revealing the source code of the WSGI scripts if they are not restricted by a <a class="reference external" href="Directory">Directory</a> section.</p> <p>Options which can be supplied to the <tt class="docutils literal"><span class="pre">WSGIScriptAlias</span></tt> directive are:</p> <dl class="docutils"> <dt><strong>process-group=name</strong></dt> <dd><p class="first">Defines which process group the WSGI application will be executed in. All WSGI applications within the same process group will execute within the context of the same group of daemon processes.</p> <p class="last">If the name is set to be <tt class="docutils literal"><span class="pre">%{GLOBAL}</span></tt> the process group name will be set to the empty string. Any WSGI applications in the global process group will always be executed within the context of the standard Apache child processes. Such WSGI applications will incur the least runtime overhead, however, they will share the same process space with other Apache modules such as PHP, as well as the process being used to serve up static file content. Running WSGI applications within the standard Apache child processes will also mean the application will run as the user that Apache would normally run as.</p> </dd> <dt><strong>application-group=name</strong></dt> <dd><p class="first">Defines which application group a WSGI application or set of WSGI applications belongs to. All WSGI applications within the same application group will execute within the context of the same Python sub interpreter of the process handling the request.</p> <p class="last">If the name is set to be <tt class="docutils literal"><span class="pre">%{GLOBAL}</span></tt> the application group will be set to the empty string. Any WSGI applications in the global application group will always be executed within the context of the first interpreter created by Python when it is initialised, of the process handling the request. Forcing a WSGI application to run within the first interpreter can be necessary when a third party C extension module for Python has used the simplified threading API for manipulation of the Python GIL and thus will not run correctly within any additional sub interpreters created by Python.</p> </dd> </dl> <p>If both <tt class="docutils literal"><span class="pre">process-group</span></tt> and <tt class="docutils literal"><span class="pre">application-group</span></tt> options are set, the WSGI script file will be pre-loaded when the process it is to run in is started, rather than being lazily loaded on the first request.</p> </div> </div> <div class="articleComments"> </div> </div> <footer> <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> <a href="WSGIScriptAliasMatch.html" class="btn btn-neutral float-right" title="WSGIScriptAliasMatch" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a> <a href="WSGIRestrictStdout.html" class="btn btn-neutral" title="WSGIRestrictStdout" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a> </div> <hr/> <div role="contentinfo"> <p> © Copyright 2007-2020, Graham Dumpleton. </p> </div> Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. </footer> </div> </div> </section> </div> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT:'../', VERSION:'4.7.1', COLLAPSE_INDEX:false, FILE_SUFFIX:'.html', HAS_SOURCE: true, SOURCELINK_SUFFIX: '' }; </script> <script type="text/javascript" src="../_static/jquery.js"></script> <script type="text/javascript" src="../_static/underscore.js"></script> <script type="text/javascript" src="../_static/doctools.js"></script> <script type="text/javascript" src="../_static/js/theme.js"></script> <script type="text/javascript"> jQuery(function () { SphinxRtdTheme.StickyNav.enable(); }); </script> </body> </html>