Compare commits
No commits in common. "e59dbe314f608da3fca21fdad2643e5626e0f94e" and "02e5e0b682ee3e12ca57037d8cbd74f3e5ec9f51" have entirely different histories.
e59dbe314f
...
02e5e0b682
6 changed files with 162 additions and 109 deletions
|
@ -16,12 +16,3 @@ tab_width = 2
|
||||||
|
|
||||||
[*.md]
|
[*.md]
|
||||||
trim_trailing_whitespace = false
|
trim_trailing_whitespace = false
|
||||||
|
|
||||||
[Caddyfile]
|
|
||||||
indent_style = tab
|
|
||||||
indent_size = 4
|
|
||||||
tab_width = 4
|
|
||||||
end_of_line = lf
|
|
||||||
charset = utf-8
|
|
||||||
trim_trailing_whitespace = true
|
|
||||||
insert_final_newline = true
|
|
||||||
|
|
|
@ -1,20 +1,11 @@
|
||||||
{
|
{
|
||||||
|
# acme_ca https://acme-v02.api.letsencrypt.org/directory
|
||||||
email {env.EMAIL}
|
email {env.EMAIL}
|
||||||
log default {
|
log {
|
||||||
output stdout
|
|
||||||
format console
|
format console
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
(error) {
|
|
||||||
root * /usr/share/caddy
|
|
||||||
rewrite * /error.html
|
|
||||||
templates
|
|
||||||
file_server {
|
|
||||||
status {err.status_code}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
*.{$DOMAIN} {
|
*.{$DOMAIN} {
|
||||||
tls {
|
tls {
|
||||||
dns netcup {
|
dns netcup {
|
||||||
|
@ -75,10 +66,7 @@
|
||||||
|
|
||||||
@www host www.{$DOMAIN}
|
@www host www.{$DOMAIN}
|
||||||
handle @www {
|
handle @www {
|
||||||
file_server {
|
reverse_proxy webserver-www:80
|
||||||
root /usr/share/caddy
|
|
||||||
hide .git Readme.md
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@mail host mail.{$DOMAIN}
|
@mail host mail.{$DOMAIN}
|
||||||
|
@ -88,26 +76,16 @@
|
||||||
|
|
||||||
# Fallback for otherwise unhandled domains
|
# Fallback for otherwise unhandled domains
|
||||||
handle {
|
handle {
|
||||||
respond "404 Not Found" 404
|
respond 404
|
||||||
}
|
|
||||||
|
|
||||||
# handle wrong url pathes
|
|
||||||
handle_errors 404 {
|
|
||||||
#respond "{err.status_code} {err.status_text}" {err.status_code}
|
|
||||||
import error
|
|
||||||
}
|
|
||||||
|
|
||||||
# handle errors of proxy backends are down
|
|
||||||
# handle_errors 502 {
|
|
||||||
# respond "503 Service Unavailable" 503
|
|
||||||
# }
|
|
||||||
|
|
||||||
# every other error
|
|
||||||
handle_errors {
|
|
||||||
import error
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{$DOMAIN} {
|
{$DOMAIN} {
|
||||||
redir https://www.{$DOMAIN}{uri}
|
redir https://www.{$DOMAIN}{uri}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,6 @@ services:
|
||||||
- $PWD/caddy/Caddyfile:/etc/caddy/Caddyfile
|
- $PWD/caddy/Caddyfile:/etc/caddy/Caddyfile
|
||||||
- ${STORAGE_PATH}/caddy/data:/data
|
- ${STORAGE_PATH}/caddy/data:/data
|
||||||
- ${STORAGE_PATH}/caddy/config:/config
|
- ${STORAGE_PATH}/caddy/config:/config
|
||||||
- ${WWW_PATH}:/usr/share/caddy:ro
|
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
- NETCUP_CUSTOMER_NUMBER=${NETCUP_CUSTOMER_NUMBER}
|
- NETCUP_CUSTOMER_NUMBER=${NETCUP_CUSTOMER_NUMBER}
|
||||||
- NETCUP_API_KEY=${NETCUP_API_KEY}
|
- NETCUP_API_KEY=${NETCUP_API_KEY}
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
docker compose exec -w /etc/caddy caddy caddy reload
|
|
21
www/docker-compose.yaml
Normal file
21
www/docker-compose.yaml
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
services:
|
||||||
|
|
||||||
|
webserver-www:
|
||||||
|
image: nginx:stable
|
||||||
|
volumes:
|
||||||
|
- ${HTML}:/usr/share/nginx/html:ro
|
||||||
|
- $PWD/nginx.conf:/etc/nginx/nginx.conf:ro
|
||||||
|
networks:
|
||||||
|
- web
|
||||||
|
restart: unless-stopped
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "curl" ,"--fail", "localhost"]
|
||||||
|
interval: 5s
|
||||||
|
timeout: 3s
|
||||||
|
labels:
|
||||||
|
- "docker.group=www"
|
||||||
|
|
||||||
|
networks:
|
||||||
|
web:
|
||||||
|
external: true
|
||||||
|
|
67
www/nginx.conf
Normal file
67
www/nginx.conf
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
user nginx;
|
||||||
|
worker_processes auto;
|
||||||
|
|
||||||
|
error_log /var/log/nginx/error.log notice;
|
||||||
|
pid /var/run/nginx.pid;
|
||||||
|
|
||||||
|
|
||||||
|
events {
|
||||||
|
worker_connections 1024;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
http {
|
||||||
|
include /etc/nginx/mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
|
||||||
|
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||||
|
'$status $body_bytes_sent "$http_referer" '
|
||||||
|
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||||
|
|
||||||
|
access_log /var/log/nginx/access.log main;
|
||||||
|
|
||||||
|
sendfile on;
|
||||||
|
#tcp_nopush on;
|
||||||
|
|
||||||
|
keepalive_timeout 65;
|
||||||
|
|
||||||
|
#gzip on;
|
||||||
|
|
||||||
|
# include /etc/nginx/conf.d/*.conf;
|
||||||
|
############################################
|
||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
listen [::]:80;
|
||||||
|
server_name localhost;
|
||||||
|
|
||||||
|
#access_log /var/log/nginx/host.access.log main;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
index index.html index.htm;
|
||||||
|
}
|
||||||
|
|
||||||
|
#error_page 404 /404.html;
|
||||||
|
|
||||||
|
# redirect server error pages to the static page /50x.html
|
||||||
|
#
|
||||||
|
error_page 500 502 503 504 /50x.html;
|
||||||
|
location = /50x.html {
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
}
|
||||||
|
|
||||||
|
# hide .git folder
|
||||||
|
location ~ /\.git {
|
||||||
|
deny all;
|
||||||
|
return 404;
|
||||||
|
}
|
||||||
|
|
||||||
|
location ~ /Readme.md {
|
||||||
|
deny all;
|
||||||
|
return 404;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
# include /etc/nginx/conf.d/*.conf;
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue