<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>The Wombelix Post - nginx</title><link href="https://dominik.wombacher.cc/" rel="alternate"/><link href="/feeds/tag_nginx.atom.xml" rel="self"/><id>https://dominik.wombacher.cc/</id><updated>2022-03-13T00:00:00+01:00</updated><entry><title>Now available as Onion Service through the Tor Network</title><link href="https://dominik.wombacher.cc/posts/now_available_as_onion_service_through_the_tor_network.html" rel="alternate"/><published>2022-03-13T00:00:00+01:00</published><updated>2022-03-13T00:00:00+01:00</updated><author><name>Dominik Wombacher</name></author><id>tag:dominik.wombacher.cc,2022-03-13:/posts/now_available_as_onion_service_through_the_tor_network.html</id><summary type="html">&lt;!-- SPDX-FileCopyrightText: 2023 Dominik Wombacher &lt;dominik@wombacher.cc&gt; --&gt;
&lt;!--  --&gt;
&lt;!-- SPDX-License-Identifier: CC-BY-SA-4.0 --&gt;
&lt;p&gt;I'm happy to announce that this site is also published as Onion Service from now on,
which means a focus on privacy, security, freedom and support for the Tor Project  ... &lt;a class="read-more" href="/posts/now_available_as_onion_service_through_the_tor_network.html"&gt; [read more]&lt;/a&gt;&lt;/p&gt;</summary><content type="html">&lt;!-- SPDX-FileCopyrightText: 2023 Dominik Wombacher &lt;dominik@wombacher.cc&gt; --&gt;
&lt;!--  --&gt;
&lt;!-- SPDX-License-Identifier: CC-BY-SA-4.0 --&gt;
&lt;p&gt;I'm happy to announce that this site is also published as Onion Service from now on,
which means a focus on privacy, security, freedom and support for the Tor Project
as well as a statement against censorship.&lt;/p&gt;
&lt;p&gt;The new Tor URL: &lt;a class="reference external" href="http://2xwpdwnzmag3ewobwsdewpor4gmca4d5gltviol3u6upihb6m6m6xaad.onion"&gt;http://2xwpdwnzmag3ewobwsdewpor4gmca4d5gltviol3u6upihb6m6m6xaad.onion&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Also it was fun to setup ;) To ensure the right URLs are used, I decided to publish two versions,
which was quite a simple task by adjusting a few lines in my &lt;a class="reference external" href="https://getpelican.com"&gt;Pelican&lt;/a&gt; configs.&lt;/p&gt;
&lt;p&gt;The Tor Service is running on the same FreeBSD Jail as my (static) site and nginx, let me share some technical details.&lt;/p&gt;
&lt;p&gt;Installing Tor is straight forward, just run &lt;code&gt;pkg install tor&lt;/code&gt; and &lt;code&gt;sysrc tor_enable=&amp;quot;YES&amp;quot;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Two lines in &lt;code&gt;/usr/local/etc/tor/torrc&lt;/code&gt; are enough to enable a new Onion Hidden Service:&lt;/p&gt;
&lt;pre class="code text literal-block"&gt;
HiddenServiceDir /var/db/tor/keys/&amp;lt;website&amp;gt;/
HiddenServicePort 80 unix:/var/run/tor-&amp;lt;website&amp;gt;.sock

&lt;/pre&gt;
&lt;p&gt;For nginx I adjusted the existing https config to publish the
&lt;a class="reference external" href="https://support.torproject.org/onionservices/onion-location/"&gt;Onion-Location&lt;/a&gt;
(Archive: &lt;a class="reference external" href="https://web.archive.org/web/20220101193148/https://support.torproject.org/onionservices/onion-location"&gt;[1]&lt;/a&gt;,
&lt;a class="reference external" href="https://archive.today/2022.03.13-233520/https://support.torproject.org/onionservices/onion-location/"&gt;[2]&lt;/a&gt;)
header, which will advertise the &lt;em&gt;.onion&lt;/em&gt; URL of this Site to visitors that are using the Tor Browser.&lt;/p&gt;
&lt;p&gt;The Onion URL can be found in &lt;code&gt;/var/db/tor/keys/&amp;lt;website&amp;gt;/hostname&lt;/code&gt;.&lt;/p&gt;
&lt;pre class="code text literal-block"&gt;
server {
        listen 443 ssl http2;
        # Tor unrelated config omitted
        add_header Onion-Location http://&amp;lt;onion_url&amp;gt;$request_uri;
}

&lt;/pre&gt;
&lt;p&gt;As recommend in the &lt;a class="reference external" href="https://community.torproject.org/onion-services/setup/"&gt;Tor Setup Guide&lt;/a&gt;
(Archive: &lt;a class="reference external" href="https://web.archive.org/web/20211108203156/https://community.torproject.org/onion-services/setup"&gt;[1]&lt;/a&gt;,
&lt;a class="reference external" href="https://archive.today/2021.09.28-062404/https://community.torproject.org/onion-services/setup/"&gt;[2]&lt;/a&gt;)
I added an additional server section and use a unix socket to listen for Tor requests.&lt;/p&gt;
&lt;pre class="code text literal-block"&gt;
server {
        listen unix:/var/run/&amp;lt;website&amp;gt;.sock;
        # Tor unrelated config omitted
        server_name &amp;lt;onion_url&amp;gt;;
        root &amp;lt;path_to_web_document_root&amp;gt;;
}

&lt;/pre&gt;
&lt;p&gt;From a Pelican perspective, I created a second &lt;code&gt;publishconf&lt;/code&gt; to set the &lt;code&gt;SITEURL&lt;/code&gt;
to my &amp;lt;onion_url&amp;gt; and adjusted the &lt;code&gt;Makefile&lt;/code&gt; a little to upload the &lt;em&gt;regular&lt;/em&gt; and the &lt;em&gt;tor&lt;/em&gt; version at once.&lt;/p&gt;
&lt;p&gt;Following the additions on top of the standard Makefile when installing Pelican.&lt;/p&gt;
&lt;pre class="code text literal-block"&gt;
PUBLISHCONF_TOR=$(BASEDIR)/publishconf_tor.py
SSH_TARGET_DIR_TOR=&amp;lt;path_to_web_document_root&amp;gt;

# Tor unrelated config omitted

rsync_upload_tor: publish_tor
        rsync -e &amp;quot;ssh -p $(SSH_PORT)&amp;quot; -P -rvzc --include tags --cvs-exclude --delete &amp;quot;$(OUTPUTDIR)&amp;quot;/ &amp;quot;$(SSH_USER)&amp;#64;$(SSH_HOST):$(SSH_TARGET_DIR_TOR)&amp;quot;

rsync_upload_all: rsync_upload rsync_upload_tor

&lt;/pre&gt;
&lt;p&gt;Last step was to start the tor service &lt;code&gt;service tor start&lt;/code&gt;,
apply the new nginx config &lt;code&gt;service nginx reload&lt;/code&gt; and to
publish the site &lt;code&gt;make rsync_upload_all&lt;/code&gt;.&lt;/p&gt;
</content><category term="Misc"/><category term="Tor"/><category term="Onion Service"/><category term="FreeBSD"/><category term="nginx"/><category term="Pelican"/></entry></feed>