Full Guide - Full stack app over hidden services (TOR)

ยท

2 min read

Hello, I'm Samir, and this is my first blog about hosting hidden services. In this blog, I'll guide you through the process of hosting your app on hidden services.

First and foremost, you'll need a server and an application. In my case, I had a RemixJS app for the front end and an ExpressJS app for the back end, and I was using a Fedora-based Linux server.

Here are the steps to get started:

  • Install TOR and Apache HTTP Server (httpd):

    • Follow the official guide to install TOR. HERE

    • Follow another official guide to install HTTPD for Fedora. Here

  • Run Your Apps:

    Start your front-end and back-end apps. I prefer using PM2 for this.

  • Configure TOR:

    Open the torrc file for configuration:

    nano /etc/tor/torrc

    Under the "location-hidden services" section, configure the hidden services for your apps:

      # For the front end
      HiddenServiceDir /var/lib/tor/my-app-service/
      HiddenServicePort 80 127.0.0.1:80
    
      # For the back end
      HiddenServiceDir /var/lib/tor/app-back-service/
      HiddenServicePort 80 127.0.0.1:80
    
  • Restart TOR:

    After configuring TOR, restart the TOR services:

    sudo systemctl restart tor

    This will create two folders under /var/lib/tor, one for each of your apps:

    • /var/lib/tor/my-app-service/

    • /var/lib/tor/app-back-service/

Inside these folders, you'll find a hostname file, which contains your onion URL.

Note: The onion URL for your front-end app can be found under my-app-service.

  • Set Up Apache Server:

    Start the Apache server:

    • sudo systemctl start httpd

    • sudosystemctl enable httpd

    • Check the status of the Apache server to ensure it's running without any issues:

      sudo systemctl status httpd

Make sure there are no failures and that no other service is using the same port (port 80).

  • Configure Apache Server:

    nano /etc/httpd/conf.d/web.conf

    Add the following configuration

    Play with ports of ProxyPass and ProxyPassReverse according to your needs

      <VirtualHost *:80>
          ServerName {ONION_DOMAIN_1}
          ProxyRequests Off
          ProxyPass / http://localhost:3000/
          ProxyPassReverse / http://localhost:3000/
      </VirtualHost>
    
      <VirtualHost *:80>
          ServerName {ONION_DOMAIN_2}
          ProxyRequests Off
          ProxyPass / http://localhost:5000/
          ProxyPassReverse / http://localhost:5000/
      </VirtualHost>
    

    R

  • Restart the Apache Server:

    sudo service httpd restart

  • Congratulations! Your website and backend are now live and accessible on the specified TOR domains. ๐Ÿš€

ย