</span><span></span><spanstyle=color:#ffb964>base_url </span><span>= </span><spanstyle=color:#99ad6a>"https://search.devraza.duckdns.org/"</span><span>; </span><spanstyle=color:#888># replace with wherever you want to host yours
</span><span> };
</span><span> };
</span><span> };
</span><span></span><spanstyle=color:#888># ...
</span><span>}
</span></code></pre><p>The snippet above starts the <code>searx</code> systemd service for listening on port <code>8888</code>, and assumes a <code>base_url</code> of <code>https://search.devraza.duckdns.org</code>.<p>Now that we've got the actual <code>searx</code> instance running, we can now set up a reverse proxy allowing the service to be accessed remotely (whether this is within your local network or across the internet is up to you).<h2id=setting-up-a-reverse-proxy>Setting up a reverse proxy<aaria-label="Anchor link for: setting-up-a-reverse-proxy"class=zola-anchorhref=#setting-up-a-reverse-proxy>#</a></h2><h3id=what-is-a-reverse-proxy>What is a reverse proxy?<aaria-label="Anchor link for: what-is-a-reverse-proxy"class=zola-anchorhref=#what-is-a-reverse-proxy>#</a></h3><p>Before I get started with the technical details of setting this up, I'd like to briefly clarify what a reverse proxy exactly is (to my understanding).<p>Let's get the wikipedia definition of reverse proxy out of the way first:<blockquote><p>[...] a reverse proxy is an application that sits in front of back-end applications and forwards client requests to those applications. [...]</blockquote><p>However, you might be confused as to what this actually means; I'll give an example of the usage of reverse proxies to better explain this:<ul><li>Suppose you've got a few services running on a server (for demonstration purposes, let's name these <code>x</code>, <code>y</code> and <code>z</code>), each running on their own unique port.<li>Assuming you had a domain, and wanted to access all of these services from their own unique sub-domains (e.g. <code>x.yourdomain.com</code>, <code>y.yourdomain.com</code> and <code>z.yourdomain.com</code>), you would have to use a reverse proxy.<li>This reverse proxy would take in requests from clients going to sub-domains, and forward these requests to the appropriate port on your machine for the service being requested.</ul><p>The concept should be clear now, if it wasn't already.<h3id=using-nginx-to-set-up-the-reverse-proxy>Using NGINX to set up the reverse proxy<aaria-label="Anchor link for: using-nginx-to-set-up-the-reverse-proxy"class=zola-anchorhref=#using-nginx-to-set-up-the-reverse-proxy>#</a></h3><p>NGINX is a popular web server that supports the creation of virtual hosts and the usage of reverse proxies. To accomodate our <code>searx</code> instance, we append the following to our NixOS server configuration:<preclass=language-nixdata-lang=nixdata-linenosstyle=background:#151515;color:#e8e8d3><codeclass=language-nixdata-lang=nix><table><tbody><tr><td>1<td><span>{
</span><tr><td>7<td><span></span><spanstyle=color:#99ad6a>"search" </span><span>= { </span><spanstyle=color:#888># this can be anything, being an arbitrary identifier
</span><tr><td>9<td><span></span><spanstyle=color:#ffb964>serverName </span><span>= </span><spanstyle=color:#99ad6a>"search.yourdomain.com"</span><span>; </span><spanstyle=color:#888># replace this with whatever you're serving from