Simple Steps to Setup an Onion Service With Apache HTTP Server on AlmaLinux 8

1) Setting Up The Apache HTTP Server

a) Installing

Install the Apache HTTP Server module.
sudo dnf module install httpd

b) Enabling Autostart

To tell systemd to start httpd service automatically at boot, enable it.
sudo systemctl enable httpd.service

c) Starting

Start the httpd service.
sudo systemctl start httpd.service
The web server will start listening on port 80 by default which will be your HiddenServicePort.

d) Letting FirewallD to Know

You may have to add the port to the FirewallD‘s allow list. Adding http service would do so.
sudo firewall-cmd --zone=public --permanent --add-service=http
Then reload the FirewallD.
sudo firewall-cmd --reload

2) Setting Up Tor

a) Installing

Install the Tor.
sudo dnf install tor

b) Configuring

Open the /etc/tor/torrc file on your favorite text editor with superuser privileges and add or edit the following lines:

HiddenServiceDir /var/lib/tor/our_hidden_project

HiddenServicePort 80 127.0.0.1:80

c) Enabling Autostart

To tell systemd to start tor service automatically at boot, enable it.
sudo systemctl enable tor.service

d) Starting

Now, start the tor service.
sudo systemctl start tor.service
Then the specified HiddenServiceDir directory will be created automatically. Inside this directory, you will find a file named hostname which will contain your hidden service’s onion address.


Documentations

Abdullah As-Sadeed

Abdullah As-Sadeed