I have created a small tutorial, where you can see how to run a Nextcloud and expose it as a tor hidden service and https at the same time.
I assume you are using Nextcloud installed on a Debian 9 virtual machine using Docker with docker-compose (see this link to instal it) and it works at cloud.example.com.
- modify the file
docker/.examples/docker-compose/with-nginx-proxy/postgres/apache/docker-compose.ymland add it two lines in theappsectionports : - 8080:80 - restart the docker container
sudo docker-compose restart app - install tor :
sudo apt-get install tor- verify tor runs correctly :
sudo apt-get install torsocks curland runtorify curl http://expyuzz4wqqyqhjn.onion/(Note : the onion link used is the torprojet home). It will show the html source.
- verify tor runs correctly :
- modify
/etc/tor/torrcand add
HiddenServiceDir /var/lib/tor
HiddenServicePort 80 127.0.0.1:8080
-
Note : Here we set the directory
/var/lib/toras the place where tor will put its file, you can chose another place.-
Warning : the chosen place has to be owned by the user running tor (on default the user is debian-tor which owns /var/lib/tor if you want to change it run
chown 700 name/of/the/directory/).
-
Warning : the chosen place has to be owned by the user running tor (on default the user is debian-tor which owns /var/lib/tor if you want to change it run
- restart tor :
sudo systemctl restart tor - copy paste the content of
/var/lib/tor/hostnamein your Tor Browser. - you should see an error message showing the following
- copy the link location found in the error message and paste it into a regular browser and replace the onion part of the url with cloud.example.com.
- confirm the .onion to be a trusted domain.
- in the Tor Browser, refresh and you should be able to log in.
That’s it ! Your Nextcloud should be online.
