Skip to content

Commit

Permalink
Added initial project files
Browse files Browse the repository at this point in the history
  • Loading branch information
harshit-budhraja committed May 16, 2021
1 parent e1730f4 commit 2719475
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.temp
tor/
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM nginx:1.20-alpine

# Metadata about the docker image
LABEL name="tor-nginx-proxy"
LABEL version="1.0.0-beta-1.0"
LABEL maintainer="Harshit Budhraja (https://github.com/harshit-budhraja)"

# Update packages and install tor
RUN apk --update --allow-untrusted --repository http://dl-4.alpinelinux.org/alpine/edge/community/ add \
tor && rm -rf /var/cache/apk/* /tmp/* /var/tmp/*

# Copy nginx and tor configurations
COPY default.conf.template /etc/nginx/templates/default.conf.template
COPY torrc /etc/tor/torrc

# Add script to start tor
COPY start-tor.sh /docker-entrypoint.d/40-start-tor.sh
RUN chmod +x /docker-entrypoint.d/40-start-tor.sh
12 changes: 12 additions & 0 deletions default.conf.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
server {
listen ${NGINX_PORT};

location / {
proxy_pass ${NGINX_PROXY_URL};
proxy_set_header Host $host:$server_port;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection upgrade;
proxy_set_header Accept-Encoding gzip;
}
}
15 changes: 15 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
version: '3'

services:
tor-nginx-proxy:
container_name: tor-nginx-proxy
image: harshitbudhraja/tor-nginx-proxy:latest
restart: unless-stopped
environment:
- NGINX_PORT=80
- NGINX_PROXY_URL=<YOUR_APP_URL>
ports:
- 3000:80
volumes:
- ./tor:/var/lib/tor/
2 changes: 2 additions & 0 deletions start-tor.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
tor -f /etc/tor/torrc
4 changes: 4 additions & 0 deletions torrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
HiddenServiceDir /var/lib/tor/hidden_service/
HiddenServicePort 80 127.0.0.1:80
Log notice stdout
RunAsDaemon 1

0 comments on commit 2719475

Please sign in to comment.