<h1>mod_wsgi<aclass="headerlink"href="#mod-wsgi"title="Link to this heading">¶</a></h1>
<p><aclass="reference external"href="https://modwsgi.readthedocs.io/">mod_wsgi</a> is a WSGI server integrated with the <aclass="reference external"href="https://httpd.apache.org/">Apache httpd</a> server.
The modern <aclass="reference external"href="https://pypi.org/project/mod-wsgi/">mod_wsgi-express</a> command makes it easy to configure and
start the server without needing to write Apache httpd configuration.</p>
<ulclass="simple">
<li><p>Tightly integrated with Apache httpd.</p></li>
<li><p>Supports Windows directly.</p></li>
<li><p>Requires a compiler and the Apache development headers to install.</p></li>
<li><p>Does not require a reverse proxy setup.</p></li>
</ul>
<p>This page outlines the basics of running mod_wsgi-express, not the more
complex installation and configuration with httpd. Be sure to read the
<aclass="reference external"href="https://pypi.org/project/mod-wsgi/">mod_wsgi-express</a>, <aclass="reference external"href="https://modwsgi.readthedocs.io/">mod_wsgi</a>, and <aclass="reference external"href="https://httpd.apache.org/">Apache httpd</a> documentation to
understand what features are available.</p>
<sectionid="installing">
<h2>Installing<aclass="headerlink"href="#installing"title="Link to this heading">¶</a></h2>
<p>Installing mod_wsgi requires a compiler and the Apache server and
development headers installed. You will get an error if they are not.
How to install them depends on the OS and package manager that you use.</p>
<p>Create a virtualenv, install your application, then install
<divclass="code-block-caption"><spanclass="caption-text"><codeclass="docutils literal notranslate"><spanclass="pre">wsgi.py</span></code></span><aclass="headerlink"href="#id2"title="Link to this code">¶</a></div>
<divclass="code-block-caption"><spanclass="caption-text"><codeclass="docutils literal notranslate"><spanclass="pre">wsgi.py</span></code></span><aclass="headerlink"href="#id3"title="Link to this code">¶</a></div>
<p>Now run the <codeclass="docutils literal notranslate"><spanclass="pre">mod_wsgi-express</span><spanclass="pre">start-server</span></code> command.</p>
<p>The <codeclass="docutils literal notranslate"><spanclass="pre">--processes</span></code> option specifies the number of worker processes to
run; a starting value could be <codeclass="docutils literal notranslate"><spanclass="pre">CPU</span><spanclass="pre">*</span><spanclass="pre">2</span></code>.</p>
<p>Logs for each request aren’t show in the terminal. If an error occurs,
its information is written to the error log file shown when starting the
server.</p>
</section>
<sectionid="binding-externally">
<h2>Binding Externally<aclass="headerlink"href="#binding-externally"title="Link to this heading">¶</a></h2>
<p>Unlike the other WSGI servers in these docs, mod_wsgi can be run as
root to bind to privileged ports like 80 and 443. However, it must be
configured to drop permissions to a different user and group for the
worker processes.</p>
<p>For example, if you created a <codeclass="docutils literal notranslate"><spanclass="pre">hello</span></code> user and group, you should
install your virtualenv and application as that user, then tell