diff --git a/.env b/.env index fb06b6d..7b27f99 100644 --- a/.env +++ b/.env @@ -4,5 +4,6 @@ POSTGRES_PASSWORD=password OWNER_UID=1000 OWNER_GID=1000 -EXTERNAL_HOST=localhost -EXTERNAL_PORT=8280 \ No newline at end of file +HTTP_HOST=localhost +HTTP_PORT=8280 +HTTPS_PORT=8281 \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index b2b0a04..6b84ae1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -29,7 +29,7 @@ services: - DB_PASS=${POSTGRES_PASSWORD} - OWNER_UID=${OWNER_UID} - OWNER_GID=${OWNER_GID} - - SELF_URL_PATH=http://${EXTERNAL_HOST}:${EXTERNAL_PORT}/tt-rss + - SELF_URL_PATH=http://${HTTP_HOST}:${HTTP_PORT}/tt-rss volumes: - app:/var/www/html depends_on: @@ -39,12 +39,28 @@ services: build: ./web restart: unless-stopped ports: - - ${EXTERNAL_PORT}:80 + - ${HTTP_PORT}:2015 volumes: - app:/var/www/html:ro depends_on: - app +# web-ssl: +# build: ./web-ssl +# restart: unless-stopped +# environment: +# - CADDYPATH=/certs +# - HTTP_HOST=${HTTP_HOST} +# ports: +# - ${HTTP_PORT}:80 +# - ${HTTPS_PORT}:443 +# volumes: +# - app:/var/www/html:ro +# - certs:/certs +# depends_on: +# - app + volumes: db: app: + certs: diff --git a/web-ssl/Caddyfile b/web-ssl/Caddyfile new file mode 100644 index 0000000..56c2239 --- /dev/null +++ b/web-ssl/Caddyfile @@ -0,0 +1,8 @@ +{%HTTP_HOST%} +tls ttrss@{%HTTP_HOST%} + +root /var/www/html +log stdout +errors stderr +internal /tt-rss/cache +fastcgi / app:9000 php \ No newline at end of file diff --git a/web-ssl/Dockerfile b/web-ssl/Dockerfile new file mode 100644 index 0000000..4d081e8 --- /dev/null +++ b/web-ssl/Dockerfile @@ -0,0 +1,3 @@ +FROM abiosoft/caddy:no-stats + +COPY Caddyfile /etc/ diff --git a/web/Caddyfile b/web/Caddyfile new file mode 100644 index 0000000..e65d2c8 --- /dev/null +++ b/web/Caddyfile @@ -0,0 +1,6 @@ +0.0.0.0 +root /var/www/html +log stdout +errors stderr +internal /tt-rss/cache +fastcgi / app:9000 php \ No newline at end of file diff --git a/web/Dockerfile b/web/Dockerfile index 9e620af..4d081e8 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -1,3 +1,3 @@ -FROM nginx:alpine +FROM abiosoft/caddy:no-stats -COPY nginx.conf /etc/nginx/nginx.conf +COPY Caddyfile /etc/ diff --git a/web/nginx.conf b/web/nginx.conf deleted file mode 100644 index efe2eea..0000000 --- a/web/nginx.conf +++ /dev/null @@ -1,55 +0,0 @@ -worker_processes auto; -pid /var/run/nginx.pid; - -events { - worker_connections 1024; -} - -http { - include /etc/nginx/mime.types; - default_type application/octet-stream; - - access_log /dev/stdout; - error_log /dev/stderr warn; - - sendfile on; - - index index.php; - - upstream app { - server app:9000; - } - - server { - listen 80; - root /var/www/html; - - location /tt-rss/cache { - aio threads; - internal; - } - - location ~ \.php$ { - # regex to split $uri to $fastcgi_script_name and $fastcgi_path - fastcgi_split_path_info ^(.+?\.php)(/.*)$; - - # Check that the PHP script exists before passing it - try_files $fastcgi_script_name =404; - - # Bypass the fact that try_files resets $fastcgi_path_info - # see: http://trac.nginx.org/nginx/ticket/321 - set $path_info $fastcgi_path_info; - fastcgi_param PATH_INFO $path_info; - - fastcgi_index index.php; - include fastcgi.conf; - - fastcgi_pass app; - } - - location / { - try_files $uri $uri/ =404; - } - - } -}