Browse Source

switch to caddy from nginx

Andrew Dolgov 10 months ago
parent
commit
0d5684ff4c
7 changed files with 40 additions and 61 deletions
  1. 3 2
      .env
  2. 18 2
      docker-compose.yml
  3. 8 0
      web-ssl/Caddyfile
  4. 3 0
      web-ssl/Dockerfile
  5. 6 0
      web/Caddyfile
  6. 2 2
      web/Dockerfile
  7. 0 55
      web/nginx.conf

+ 3 - 2
.env

@@ -4,5 +4,6 @@ POSTGRES_PASSWORD=password
 OWNER_UID=1000
 OWNER_GID=1000
 
-EXTERNAL_HOST=localhost
-EXTERNAL_PORT=8280
+HTTP_HOST=localhost
+HTTP_PORT=8280
+HTTPS_PORT=8281

+ 18 - 2
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:

+ 8 - 0
web-ssl/Caddyfile

@@ -0,0 +1,8 @@
+{%HTTP_HOST%}
+tls [email protected]{%HTTP_HOST%}
+
+root /var/www/html
+log stdout
+errors stderr
+internal /tt-rss/cache
+fastcgi / app:9000 php

+ 3 - 0
web-ssl/Dockerfile

@@ -0,0 +1,3 @@
+FROM abiosoft/caddy:no-stats
+
+COPY Caddyfile /etc/

+ 6 - 0
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

+ 2 - 2
web/Dockerfile

@@ -1,3 +1,3 @@
-FROM nginx:alpine
+FROM abiosoft/caddy:no-stats
 
-COPY nginx.conf /etc/nginx/nginx.conf
+COPY Caddyfile /etc/

+ 0 - 55
web/nginx.conf

@@ -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;
-		}
-
-	}
-}