docker-samples/onion-service/README.md
2025-05-01 11:51:09 -06:00

51 lines
No EOL
1.8 KiB
Markdown

# Onion Service Setup
This folder contains a Dockerized setup for hosting an Onion Service using Tor and Nginx. The service is designed to be secure and lightweight, leveraging Docker's isolation and Tor's anonymity.
## Overview
The setup includes:
- **Nginx**: Serves static files from the `site/` directory.
- **Tor**: Configured as an Onion Service to route traffic anonymously.
- **Docker Compose**: Manages the services and their dependencies.
## Prerequisites
1. Install Docker and Docker Compose on your system.
2. Ensure you have a basic understanding of Docker and Tor.
## Setup Steps
1. Clone this repository or copy the files to your local machine.
2. Navigate to the `onion-service/` directory.
3. Update the `.env` file with appropriate values for `NGINX_UID` and `NGINX_GID` if needed.
4. Run the `setup.sh` script to initialize the environment and set up necessary configurations.
```bash
./setup.sh init
```
The `setup.sh` script performs the following tasks:
- Sets up the required directory structure.
- Ensures proper permissions for the `data/tor/` directory.
5. Start the services using Docker Compose:
```bash
docker-compose up -d
```
6. Access your Onion Service using the `.onion` address generated by Tor. The address can be found in the `data/tor/tor/hostname` file after the services are running.
## Directory Structure
- `site/`: Contains the static files served by Nginx.
- `tor/`: Contains Tor configuration and data.
- `nginx.conf`: Configuration file for Nginx.
- `docker-compose.yml`: Docker Compose file to manage the services.
- `setup.sh`: Script to initialize the environment.
## Notes
- The Nginx service is configured to run with minimal privileges for enhanced security.
- The Tor service is set to read-only mode to prevent unauthorized modifications.