Compare commits

...

2 Commits

Author SHA1 Message Date
8057cdb44d nginx
maybe uses less cpu idk
2023-07-22 21:07:26 -07:00
8364c23c5f mount app instead of build into image 2023-07-22 21:05:26 -07:00
3 changed files with 80 additions and 10 deletions

View File

@ -2,8 +2,8 @@ FROM python:3.11
RUN useradd -r -m u2b RUN useradd -r -m u2b
RUN apt update && apt install -y ffmpeg RUN apt update && apt install -y ffmpeg
RUN pip install --no-cache-dir python-ffmpeg yt-dlp RUN pip install --no-cache-dir python-ffmpeg yt-dlp
COPY . /app #COPY . /app
WORKDIR /app #WORKDIR /app
USER u2b USER u2b
ENV PORT=8080 #ENV PORT=8080
CMD ["python", "server.py"] #CMD ["python", "server.py"]

View File

@ -4,19 +4,33 @@ services:
app: app:
build: . build: .
restart: always restart: always
volumes:
- ./:/app/
working_dir: /app/
environment: environment:
- PORT=8080
- PROXY=/proxy/ - PROXY=/proxy/
caddy: command: python server.py
image: caddy:2.6 # caddy:
# image: caddy:2.6
# restart: always
# ports:
# - "80:80"
# - "443:443"
# - "443:443/udp"
# volumes:
# - ./Caddyfile:/etc/caddy/Caddyfile
# - caddy_data:/data
# - caddy_config:/config
nginx:
image: nginx:1.25
restart: always restart: always
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
ports: ports:
- "80:80" - "80:80"
- "443:443" - "443:443"
- "443:443/udp" - "443:443/udp"
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile
- caddy_data:/data
- caddy_config:/config
volumes: volumes:
caddy_data: caddy_data:
caddy_config: caddy_config:

56
nginx.conf Normal file
View File

@ -0,0 +1,56 @@
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
log_format main '$time_local $remote_addr "$request" $status "$http_user_agent"';
access_log /var/log/nginx/access.log main;
resolver 8.8.8.8 ipv6=off;#until I can get ipv6 on the new host
server {
listen 80;
location /proxy/ {
limit_except GET { deny all; }
location ~^/proxy/([a-z0-9-]+)\.googlevideo\.com/videoplayback {
#return 200 "$uri\n\n$request_uri\n\n$query_string\n\nhttps://$1/$2";
proxy_pass https://$1.googlevideo.com/videoplayback?$query_string;
#proxy_redirect ~https://([a-z0-9-]+).googlevideo.com/ /proxy/$1.googlevideo.com/;
proxy_redirect https:// /proxy/;
}
return 403;
}
location = / {
return 301 https://www.u2b.cx/;
}
location = /favicon.ico {
return 404;
}
location /. {
return 403;
}
location = /robots.txt {
add_header Content-Type text/plain;
return 200 "User-agent: *\nDisallow: /\n";
}
if ($request_method != GET) {
return 403;
}
location / {
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://app:8080;
}
}
}