From d44e52c3caa6b967c7b7b651c7e9717978b73202 Mon Sep 17 00:00:00 2001 From: bgme Date: Sat, 20 May 2023 01:13:26 +0800 Subject: [PATCH] fix caddy-git --- repo/caddy-git/Caddyfile | 41 ++++++++++++++++++++++++++- repo/caddy-git/caddy.sysusers | 2 +- repo/caddy-git/caddy.tmpfiles | 4 ++- repo/caddy-git/main.go | 53 ++++++++++++++++++++++++++++++++++- 4 files changed, 96 insertions(+), 4 deletions(-) mode change 120000 => 100644 repo/caddy-git/Caddyfile mode change 120000 => 100644 repo/caddy-git/caddy.sysusers mode change 120000 => 100644 repo/caddy-git/caddy.tmpfiles mode change 120000 => 100644 repo/caddy-git/main.go diff --git a/repo/caddy-git/Caddyfile b/repo/caddy-git/Caddyfile deleted file mode 120000 index 2a04384..0000000 --- a/repo/caddy-git/Caddyfile +++ /dev/null @@ -1 +0,0 @@ -../caddy/Caddyfile \ No newline at end of file diff --git a/repo/caddy-git/Caddyfile b/repo/caddy-git/Caddyfile new file mode 100644 index 0000000..e8dda50 --- /dev/null +++ b/repo/caddy-git/Caddyfile @@ -0,0 +1,40 @@ +# The Caddyfile is an easy way to configure your Caddy web server. +# +# https://caddyserver.com/docs/caddyfile +# +# The configuration below serves a welcome page over HTTP on port 80. +# To use your own domain name (with automatic HTTPS), first make +# sure your domain's A/AAAA DNS records are properly pointed to +# this machine's public IP, then replace the line below with your +# domain name. +# +# https://caddyserver.com/docs/caddyfile/concepts#addresses + +{ + # Restrict the admin interface to a local unix file socket whose directory + # is restricted to caddy:caddy. By default the TCP socket allows arbitrary + # modification for any process and user that has access to the local + # interface. If admin over TCP is turned on one should make sure + # implications are well understood. + admin "unix//run/caddy/admin.socket" +} + +http:// { + # Set this path to your site's directory. + root * /usr/share/caddy + + # Enable the static file server. + file_server + + # Another common task is to set up a reverse proxy: + # reverse_proxy localhost:8080 + + # Or serve a PHP site through php-fpm: + # php_fastcgi localhost:9000 + + # Refer to the directive documentation for more options. + # https://caddyserver.com/docs/caddyfile/directives +} + +# Import additional caddy config files in /etc/caddy/conf.d/ +import /etc/caddy/conf.d/* diff --git a/repo/caddy-git/caddy.sysusers b/repo/caddy-git/caddy.sysusers deleted file mode 120000 index 8bdef6d..0000000 --- a/repo/caddy-git/caddy.sysusers +++ /dev/null @@ -1 +0,0 @@ -../caddy/caddy.sysusers \ No newline at end of file diff --git a/repo/caddy-git/caddy.sysusers b/repo/caddy-git/caddy.sysusers new file mode 100644 index 0000000..6fb5633 --- /dev/null +++ b/repo/caddy-git/caddy.sysusers @@ -0,0 +1 @@ +u caddy - "caddy daemon" /var/lib/caddy diff --git a/repo/caddy-git/caddy.tmpfiles b/repo/caddy-git/caddy.tmpfiles deleted file mode 120000 index 1a0248e..0000000 --- a/repo/caddy-git/caddy.tmpfiles +++ /dev/null @@ -1 +0,0 @@ -../caddy/caddy.tmpfiles \ No newline at end of file diff --git a/repo/caddy-git/caddy.tmpfiles b/repo/caddy-git/caddy.tmpfiles new file mode 100644 index 0000000..25f170f --- /dev/null +++ b/repo/caddy-git/caddy.tmpfiles @@ -0,0 +1,3 @@ +d /var/lib/caddy 0750 caddy caddy +d /var/log/caddy 0750 caddy caddy +d /run/caddy 0750 caddy caddy diff --git a/repo/caddy-git/main.go b/repo/caddy-git/main.go deleted file mode 120000 index 80d5db7..0000000 --- a/repo/caddy-git/main.go +++ /dev/null @@ -1 +0,0 @@ -../caddy/main.go \ No newline at end of file diff --git a/repo/caddy-git/main.go b/repo/caddy-git/main.go new file mode 100644 index 0000000..6b73a96 --- /dev/null +++ b/repo/caddy-git/main.go @@ -0,0 +1,52 @@ +// Copyright 2015 Matthew Holt and The Caddy Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Package main is the entry point of the Caddy application. +// Most of Caddy's functionality is provided through modules, +// which can be plugged in by adding their import below. +// +// There is no need to modify the Caddy source code to customize your +// builds. You can easily build a custom Caddy with these simple steps: +// +// 1. Copy this file (main.go) into a new folder +// 2. Edit the imports below to include the modules you want plugged in +// 3. Run `go mod init caddy` +// 4. Run `go install` or `go build` - you now have a custom binary! +// +// Or you can use xcaddy which does it all for you as a command: +// https://github.com/caddyserver/xcaddy +package main + +import ( + caddycmd "github.com/caddyserver/caddy/v2/cmd" + + // plug in Caddy modules here + _ "github.com/caddyserver/caddy/v2/modules/standard" + + _ "github.com/caddyserver/forwardproxy" + + _ "github.com/mholt/caddy-ratelimit" + _ "github.com/caddyserver/replace-response" + _ "github.com/silinternational/certmagic-storage-dynamodb/v3" + _ "github.com/abiosoft/caddy-json-schema" + _ "github.com/fvbommel/caddy-combine-ip-ranges" + _ "github.com/fvbommel/caddy-dns-ip-range" + _ "github.com/WeidiDeng/caddy-cloudflare-ip" + _ "github.com/zhangjiayin/caddy-geoip2" + _ "github.com/corazawaf/coraza-caddy" +) + +func main() { + caddycmd.Main() +}