Skip to content

Commit 2719475

Browse files
Added initial project files
1 parent e1730f4 commit 2719475

File tree

6 files changed

+53
-0
lines changed

6 files changed

+53
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.temp
2+
tor/

Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM nginx:1.20-alpine
2+
3+
# Metadata about the docker image
4+
LABEL name="tor-nginx-proxy"
5+
LABEL version="1.0.0-beta-1.0"
6+
LABEL maintainer="Harshit Budhraja (https://github.com/harshit-budhraja)"
7+
8+
# Update packages and install tor
9+
RUN apk --update --allow-untrusted --repository http://dl-4.alpinelinux.org/alpine/edge/community/ add \
10+
tor && rm -rf /var/cache/apk/* /tmp/* /var/tmp/*
11+
12+
# Copy nginx and tor configurations
13+
COPY default.conf.template /etc/nginx/templates/default.conf.template
14+
COPY torrc /etc/tor/torrc
15+
16+
# Add script to start tor
17+
COPY start-tor.sh /docker-entrypoint.d/40-start-tor.sh
18+
RUN chmod +x /docker-entrypoint.d/40-start-tor.sh

default.conf.template

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
server {
2+
listen ${NGINX_PORT};
3+
4+
location / {
5+
proxy_pass ${NGINX_PROXY_URL};
6+
proxy_set_header Host $host:$server_port;
7+
proxy_set_header X-Forwarded-For $remote_addr;
8+
proxy_set_header Upgrade $http_upgrade;
9+
proxy_set_header Connection upgrade;
10+
proxy_set_header Accept-Encoding gzip;
11+
}
12+
}

docker-compose.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
version: '3'
3+
4+
services:
5+
tor-nginx-proxy:
6+
container_name: tor-nginx-proxy
7+
image: harshitbudhraja/tor-nginx-proxy:latest
8+
restart: unless-stopped
9+
environment:
10+
- NGINX_PORT=80
11+
- NGINX_PROXY_URL=<YOUR_APP_URL>
12+
ports:
13+
- 3000:80
14+
volumes:
15+
- ./tor:/var/lib/tor/

start-tor.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/sh
2+
tor -f /etc/tor/torrc

torrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
HiddenServiceDir /var/lib/tor/hidden_service/
2+
HiddenServicePort 80 127.0.0.1:80
3+
Log notice stdout
4+
RunAsDaemon 1

0 commit comments

Comments
 (0)