diff --git a/Dockerfile b/Dockerfile index 8f4db3f..d1494e9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,42 +1,12 @@ -FROM debian:latest +# Используем nginx:alpine как базовый образ +FROM nginx:alpine -ARG MODULE=ngx_http_proxy_connect_module -ARG VERSION=1.19.3 -ARG PREFIX=/etc/nginx -# Required packages -RUN set -eux; \ - apt-get update; \ - apt-get install --no-install-recommends --no-install-suggests -y \ - ca-certificates git wget \ - build-essential libssl-dev libpcre3-dev zlib1g-dev; \ - rm -rf /var/lib/apt/lists/* +# Удаляем конфигурацию по умолчанию +RUN rm /etc/nginx/conf.d/default.conf -# Build nginx -WORKDIR /usr/src/ -RUN set -eux; \ - git clone https://github.com/chobits/$MODULE; \ - wget http://nginx.org/download/nginx-$VERSION.tar.gz; \ - tar xzf nginx-$VERSION.tar.gz; \ - cd nginx-$VERSION; \ - patch -p1 < ../$MODULE/patch/proxy_connect_rewrite_1018.patch; \ - ./configure \ - --prefix=$PREFIX --sbin-path=/usr/bin \ - --with-threads \ - --with-http_ssl_module --add-module=../$MODULE; \ - make; \ - make install; \ - make clean; \ - cd -; \ - rm -rf ./* - -# Logging -RUN set -eux; \ - ln -sf /dev/stdout $PREFIX/logs/access.log; \ - ln -sf /dev/stderr $PREFIX/logs/error.log +# Копируем наш конфигурационный файл в нужную директорию +COPY conf/nginx.conf /etc/nginx/conf.d/nginx.conf -EXPOSE 80 - -STOPSIGNAL SIGQUIT - -CMD ["nginx", "-g", "daemon off;"] +# Открываем порт 80 +EXPOSE 8080 diff --git a/conf/nginx.conf b/conf/nginx.conf index 095a9e9..998ec36 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,46 +1,13 @@ -events {} - -worker_processes 5; - -http { - server { - listen 80; - - # DNS servers - include resolver.conf; - - # Allow direct connections - proxy_connect; - proxy_connect_read_timeout 30s; - proxy_connect_send_timeout 30s; - proxy_ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; - - # Permissive: no common web server ports bypass - # proxy_connect 1-79 81-8079 8081-65535; - # Restrictive: just default HTTPS port - proxy_connect_allow 443; - - # Defaults to HTTPS - location / { - # Fallback to original connection scheme - error_page 502 = @fallback; - - # Will only upgrade HTTP - if ($scheme != "http") { - return 502; - } - - # Generated HTTPS bypass whitelist - include bypass/all.conf; - - proxy_pass https://$http_host; - include proxy.conf; - } - - location @fallback { - # Proxy any scheme - proxy_pass $scheme://$http_host; - include proxy.conf; - } +server { + listen 8080; + + location / { + proxy_pass http://91.84.100.81:80; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + proxy_set_header Host $host; } } + + diff --git a/fly.toml b/fly.toml new file mode 100644 index 0000000..7ca7886 --- /dev/null +++ b/fly.toml @@ -0,0 +1,23 @@ +# fly.toml app configuration file generated for https-upgrader on 2025-05-20T15:04:44Z +# +# See https://fly.io/docs/reference/configuration/ for information about how to use this file. +# + +app = 'https-upgrader' +primary_region = 'ams' + +[build] + +[http_service] + internal_port = 8080 + force_https = true + auto_stop_machines = 'stop' + auto_start_machines = true + min_machines_running = 0 + processes = ['app'] + +[[vm]] + memory = '1gb' + cpu_kind = 'shared' + cpus = 1 + memory_mb = 1024