<spanid="installation-apache"></span><h1>Install with apache<aclass="headerlink"href="#install-with-apache"title="Permalink to this headline">¶</a></h1>
<h2><aclass="toc-backref"href="#id2">The apache HTTP server</a><aclass="headerlink"href="#the-apache-http-server"title="Permalink to this headline">¶</a></h2>
<p>If <aclass="reference external"href="https://httpd.apache.org/">Apache</a> is not installed, install it now. If <aclass="reference external"href="https://httpd.apache.org/">apache</a> is new to you, the
<aclass="reference external"href="https://httpd.apache.org/docs/current/en/getting-started.html">Getting Started</a>, <aclass="reference external"href="https://httpd.apache.org/docs/current/en/configuring.html">Configuration Files</a> and <aclass="reference external"href="https://httpd.apache.org/docs/current/en/mod/directive-dict.html">Terms Used to Describe
Directives</a> documentation gives first orientation. There is also a list of
<aclass="reference external"href="https://httpd.apache.org/docs/trunk/mod/directives.html">Apache directives</a><em>to keep in the pocket</em>.</p>
<divclass="sphinx-tabs docutils container">
<divclass="ui top attached tabular menu sphinx-menu docutils container">
<p>In this file, there is a line setting the <aclass="reference external"href="https://httpd.apache.org/docs/trunk/mod/core.html#documentroot">DocumentRoot</a> directive:</p>
<p>And the <em>welcome</em> page is the HTML file at <codeclass="docutils literal notranslate"><spanclass="pre">/var/www/html/index.html</span></code>.</p>
<p>In this file, there is a line setting the <aclass="reference external"href="https://httpd.apache.org/docs/trunk/mod/core.html#documentroot">DocumentRoot</a> directive:</p>
<spanid="apache-searx-site"></span><h2><aclass="toc-backref"href="#id3">Apache Reverse Proxy</a><aclass="headerlink"href="#apache-reverse-proxy"title="Permalink to this headline">¶</a></h2>
<divclass="sidebar">
<pclass="sidebar-title">public to the internet?</p>
<p>If your searx instance is public, stop here and first install <aclass="reference internal"href="../utils/filtron.sh.html#filtron-sh"><spanclass="std std-ref">filtron
reverse proxy</span></a> and <aclass="reference internal"href="../utils/morty.sh.html#morty-sh"><spanclass="std std-ref">result proxy morty</span></a>, see
<aclass="reference internal"href="installation.html#installation-scripts"><spanclass="std std-ref">Installation scripts</span></a>. If already done, follow setup: <em>searx via
filtron plus morty</em>.</p>
</div>
<p>To setup a Apache revers proxy you have to enable the <em>headers</em> and <em>proxy</em>
modules and create a <aclass="reference external"href="https://httpd.apache.org/docs/trunk/mod/core.html#location">Location</a> configuration for the searx site. In most
distributions you have to un-comment the lines in the main configuration file,
except in <aclass="reference internal"href="#the-debian-layout"><spanclass="std std-ref">The Debian Layout</span></a>.</p>
<p>To pass the HTTP HOST header
With <aclass="reference external"href="https://httpd.apache.org/docs/trunk/mod/mod_proxy.html#proxypreservehost">ProxyPreserveHost</a> the incoming Host HTTP request header is passed to the
proxied host.</p>
<divclass="sphinx-tabs docutils container">
<divclass="ui top attached tabular menu sphinx-menu docutils container">
<p>In <aclass="reference internal"href="#the-debian-layout"><spanclass="std std-ref">The Debian Layout</span></a> you create a <codeclass="docutils literal notranslate"><spanclass="pre">searx.conf</span></code> with the
<codeclass="docutils literal notranslate"><spanclass="pre"><Location</span><spanclass="pre">/searx</span><spanclass="pre">></span></code> directive and save this file in the <em>sites
available</em> folder at <codeclass="docutils literal notranslate"><spanclass="pre">/etc/apache2/sites-available</span></code>. To enable the
<codeclass="docutils literal notranslate"><spanclass="pre">searx.conf</span></code> use <aclass="reference external"href="https://manpages.debian.org/jump?q=a2ensite">a2ensite</a>:</p>
<divclass="ui bottom attached sphinx-tab tab segment sphinx-data-tab-c2VhcnggdmlhIGZpbHRyb24gcGx1cyBtb3J0eQ== active docutils container">
<p>Use this setup, if your instance is public to the internet, compare
figure: <aclass="reference internal"href="architecture.html#arch-public"><spanclass="std std-ref">architecture</span></a> and <aclass="reference internal"href="installation.html#installation-scripts"><spanclass="std std-ref">Installation scripts</span></a>.</p>
<olclass="arabic simple">
<li><p>Configure a reverse proxy for <aclass="reference internal"href="../utils/filtron.sh.html#filtron-sh"><spanclass="std std-ref">filtron</span></a>, listening on
<em>localhost 4004</em> (<aclass="reference internal"href="filtron.html#filtron-route-request"><spanclass="std std-ref">Route request through filtron</span></a>):</p></li>
low-traffic instances. For a fully result proxification add <aclass="reference internal"href="morty.html#searx-morty"><spanclass="std std-ref">morty’s</span></a><strong>public URL</strong> to your <aclass="reference external"href="https://github.com/searx/searx/blob/master/searx/settings.yml">git://searx/settings.yml</a>:</p>
<h2><aclass="toc-backref"href="#id4">uWSGI support</a><aclass="headerlink"href="#uwsgi-support"title="Permalink to this headline">¶</a></h2>
<p>Be warned, with this setup, your instance isn’t <aclass="reference internal"href="filtron.html#searx-filtron"><spanclass="std std-ref">protected</span></a>, nevertheless it is good enough for intranet usage. In modern Linux
distributions, the <aclass="reference external"href="https://uwsgi-docs.readthedocs.io/en/latest/Apache.html#mod-proxy-uwsgi">mod_proxy_uwsgi</a> is compiled into the <em>normal</em> apache
package and you need to install only the <aclass="reference internal"href="installation-uwsgi.html#searx-uwsgi"><spanclass="std std-ref">uWSGI</span></a> package:</p>
<divclass="sphinx-tabs docutils container">
<divclass="ui top attached tabular menu sphinx-menu docutils container">
<p>The next example shows a configuration using the <aclass="reference external"href="https://uwsgi-docs.readthedocs.io/en/latest/Apache.html">uWSGI Apache support</a> via
unix sockets and <aclass="reference external"href="https://uwsgi-docs.readthedocs.io/en/latest/Apache.html#mod-proxy-uwsgi">mod_proxy_uwsgi</a>.</p>
<p>For socket communication, you have to activate <codeclass="docutils literal notranslate"><spanclass="pre">socket</span><spanclass="pre">=</span>
<spanclass="pre">/run/uwsgi/app/searx/socket</span></code> and comment out the <codeclass="docutils literal notranslate"><spanclass="pre">http</span><spanclass="pre">=</span><spanclass="pre">127.0.0.1:8888</span></code>
configuration in your <aclass="reference internal"href="installation-uwsgi.html#uwsgi-configuration"><spanclass="std std-ref">uwsgi ini file</span></a>. If not
already exists, create a folder for the unix sockets, which can be used by the
searx account (see <aclass="reference internal"href="installation-searx.html#create-searx-user"><spanclass="std std-ref">Create user</span></a>):</p>
<p>If the server is public; to limit access to your intranet replace <codeclass="docutils literal notranslate"><spanclass="pre">Allow</span><spanclass="pre">from</span>
<spanclass="pre">all</span></code> directive and replace <codeclass="docutils literal notranslate"><spanclass="pre">192.168.0.0/16</span></code> with your subnet IP/class.</p>
<divclass="sphinx-tabs docutils container">
<divclass="ui top attached tabular menu sphinx-menu docutils container">
<p>We show this only for historical reasons, DON’T USE <aclass="reference external"href="https://uwsgi-docs.readthedocs.io/en/latest/Apache.html#mod-uwsgi">mod_uwsgi</a>.
<spanclass="nb">Deny</span> from <spanclass="k">all</span>
<spanclass="c"># Allow from fd00::/8 192.168.0.0/16 fe80::/10 127.0.0.0/8 ::1</span>
<spanclass="nb">Allow</span> from <spanclass="k">all</span>
<spanclass="nt"></Location></span>
<spanclass="nt"></IfModule></span>
</pre></div>
</div>
</div>
</div>
</div>
<divclass="section"id="restart-service">
<spanid="restart-apache"></span><h2><aclass="toc-backref"href="#id5">Restart service</a><aclass="headerlink"href="#restart-service"title="Permalink to this headline">¶</a></h2>
<divclass="sphinx-tabs docutils container">
<divclass="ui top attached tabular menu sphinx-menu docutils container">
<p>The <codeclass="docutils literal notranslate"><spanclass="pre">CustomLog</span></code> directive disable logs for the whole (virtual) server, use it
when the URL of the service does not have a path component (<codeclass="docutils literal notranslate"><spanclass="pre">/searx</span></code>) / is
located at root (<codeclass="docutils literal notranslate"><spanclass="pre">/</span></code>).</p>
</div>
<divclass="section"id="the-debian-layout">
<spanid="id1"></span><h2><aclass="toc-backref"href="#id7">The Debian Layout</a><aclass="headerlink"href="#the-debian-layout"title="Permalink to this headline">¶</a></h2>
<p>Be aware that the Debian layout is quite different from the standard Apache
configuration. For details look at the <aclass="reference external"href="https://salsa.debian.org/apache-team/apache2/raw/master/debian/apache2.README.Debian">README.Debian</a>
(<codeclass="docutils literal notranslate"><spanclass="pre">/usr/share/doc/apache2/README.Debian.gz</span></code>). Some commands you should know on
Debian:</p>
<ulclass="simple">
<li><p><aclass="reference external"href="https://manpages.debian.org/jump?q=apache2ctl">apache2ctl</a>: Apache HTTP server control interface</p></li>