<h1>Apache Config<aclass="headerlink"href="#apache-config"title="Permalink to this headline">¶</a></h1>
<p><strong>Warning</strong>: This information is presented as a convenience, using another webserver than Evennia’s
own is not directly supported and you are on your own if you want to do so. Evennia’s webserver
works out of the box without any extra configuration and also runs in-process making sure to avoid
caching race conditions. The browser web client will most likely not work (at least not without
tweaking) on a third-party web server.</p>
<p>One reason for wanting to use an external webserver like Apache would be to act as a <em>proxy</em> in
front of the Evennia webserver. Getting this working with TLS (encryption) requires some extra work
covered at the end of this page.</p>
<p>Note that the Apache instructions below might be outdated. If something is not working right, or you
use Evennia with a different server, please let us know. Also, if there is a particular Linux distro
you would like covered, please let us know.</p>
<divclass="section"id="mod-wsgi-setup">
<h2><codeclass="docutils literal notranslate"><spanclass="pre">mod_wsgi</span></code> Setup<aclass="headerlink"href="#mod-wsgi-setup"title="Permalink to this headline">¶</a></h2>
<divclass="section"id="install-mod-wsgi">
<h3>Install <codeclass="docutils literal notranslate"><spanclass="pre">mod_wsgi</span></code><aclass="headerlink"href="#install-mod-wsgi"title="Permalink to this headline">¶</a></h3>
<li><p><em>Fedora/RHEL</em> - Apache HTTP Server and <codeclass="docutils literal notranslate"><spanclass="pre">mod_wsgi</span></code> are available in the standard package
<li><p><em>Ubuntu/Debian</em> - Apache HTTP Server and <codeclass="docutils literal notranslate"><spanclass="pre">mod_wsgi</span></code> are available in the standard package
<h3>Copy and modify the VHOST<aclass="headerlink"href="#copy-and-modify-the-vhost"title="Permalink to this headline">¶</a></h3>
<p>After <codeclass="docutils literal notranslate"><spanclass="pre">mod_wsgi</span></code> is installed, copy the <codeclass="docutils literal notranslate"><spanclass="pre">evennia/web/utils/evennia_wsgi_apache.conf</span></code> file to your
apache2 vhosts/sites folder. On Debian/Ubuntu, this is <codeclass="docutils literal notranslate"><spanclass="pre">/etc/apache2/sites-enabled/</span></code>. Make your
modifications <strong>after</strong> copying the file there.</p>
<p>Read the comments and change the paths to point to the appropriate locations within your setup.</p>
</div>
<divclass="section"id="restart-reload-apache">
<h3>Restart/Reload Apache<aclass="headerlink"href="#restart-reload-apache"title="Permalink to this headline">¶</a></h3>
<p>You’ll then want to reload or restart apache2 after changing the configurations.</p>
<h3>Enjoy<aclass="headerlink"href="#enjoy"title="Permalink to this headline">¶</a></h3>
<p>With any luck, you’ll be able to point your browser at your domain or subdomain that you set up in
your vhost and see the nifty default Evennia webpage. If not, read the hopefully informative error
message and work from there. Questions may be directed to our <aclass="reference external"href="http://evennia.com">Evennia Community
site</a>.</p>
</div>
<divclass="section"id="a-note-on-code-reloading">
<h3>A note on code reloading<aclass="headerlink"href="#a-note-on-code-reloading"title="Permalink to this headline">¶</a></h3>
<p>If your <codeclass="docutils literal notranslate"><spanclass="pre">mod_wsgi</span></code> is set up to run on daemon mode (as will be the case by default on Debian and
Ubuntu), you may tell <codeclass="docutils literal notranslate"><spanclass="pre">mod_wsgi</span></code> to reload by using the <codeclass="docutils literal notranslate"><spanclass="pre">touch</span></code> command on
<codeclass="docutils literal notranslate"><spanclass="pre">evennia/game/web/utils/apache_wsgi.conf</span></code>. When <codeclass="docutils literal notranslate"><spanclass="pre">mod_wsgi</span></code> sees that the file modification time has
changed, it will force a code reload. Any modifications to the code will not be propagated to the
<h3>Further notes and hints:<aclass="headerlink"href="#further-notes-and-hints"title="Permalink to this headline">¶</a></h3>
<p>If you get strange (and usually uninformative) <codeclass="docutils literal notranslate"><spanclass="pre">Permission</span><spanclass="pre">denied</span></code> errors from Apache, make sure
that your <codeclass="docutils literal notranslate"><spanclass="pre">evennia</span></code> directory is located in a place the webserver may actually access. For example,
some Linux distributions may default to very restrictive access permissions on a user’s <codeclass="docutils literal notranslate"><spanclass="pre">/home</span></code>
directory.</p>
<p>One user commented that they had to add the following to their Apache config to get things to work.
Not confirmed, but worth trying if there are trouble.</p>
<h2><codeclass="docutils literal notranslate"><spanclass="pre">mod_proxy</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">mod_ssl</span></code> setup<aclass="headerlink"href="#mod-proxy-and-mod-ssl-setup"title="Permalink to this headline">¶</a></h2>
<p>Below are steps on running Evennia using a front-end proxy (Apache HTTP), <codeclass="docutils literal notranslate"><spanclass="pre">mod_proxy_http</span></code>,
<codeclass="docutils literal notranslate"><spanclass="pre">mod_proxy_wstunnel</span></code>, and <codeclass="docutils literal notranslate"><spanclass="pre">mod_ssl</span></code>. <codeclass="docutils literal notranslate"><spanclass="pre">mod_proxy_http</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">mod_proxy_wstunnel</span></code> will simply be
<h3>Install <codeclass="docutils literal notranslate"><spanclass="pre">mod_ssl</span></code><aclass="headerlink"href="#install-mod-ssl"title="Permalink to this headline">¶</a></h3>
<li><p><em>Fedora/RHEL</em> - Apache HTTP Server and <codeclass="docutils literal notranslate"><spanclass="pre">mod_ssl</span></code> are available in the standard package
<li><p><em>Ubuntu/Debian</em> - Apache HTTP Server and <codeclass="docutils literal notranslate"><spanclass="pre">mod_sslj</span></code>kl are installed together in the <codeclass="docutils literal notranslate"><spanclass="pre">apache2</span></code>
package and available in the
standard package repositories for Ubuntu and Debian. <codeclass="docutils literal notranslate"><spanclass="pre">mod_ssl</span></code> needs to be enabled after
<h4>Evennia secure websocket configuration<aclass="headerlink"href="#evennia-secure-websocket-configuration"title="Permalink to this headline">¶</a></h4>
<p>There is a slight trick in setting up Evennia so websocket traffic is handled correctly by the
proxy. You must set the <codeclass="docutils literal notranslate"><spanclass="pre">WEBSOCKET_CLIENT_URL</span></code> setting in your <codeclass="docutils literal notranslate"><spanclass="pre">mymud/server/conf/settings.py</span></code> file:</p>
<p>The setting above is what the client’s browser will actually use. Note the use of <codeclass="docutils literal notranslate"><spanclass="pre">wss://</span></code> is
because our client will be communicating over an encrypted connection (“wss” indicates websocket
over SSL/TLS). Also, especially note the additional path <codeclass="docutils literal notranslate"><spanclass="pre">/ws</span></code> at the end of the URL. This is how
Apache HTTP Server identifies that a particular request should be proxied to Evennia’s websocket
port but this should be applicable also to other types of proxies (like nginx).</p>