diff --git a/host/layer/public-webserver/caddy/Caddyfile b/host/layer/public-webserver/caddy/Caddyfile index 54086f3..83ca1a3 100755 --- a/host/layer/public-webserver/caddy/Caddyfile +++ b/host/layer/public-webserver/caddy/Caddyfile @@ -8,4 +8,13 @@ http:// { browse /etc/caddy/browse_template.html hide \.* } + + templates + + handle_errors { + @404 { + expression {http.error.status_code} == 404 + } + rewrite @404 /404.html + } } diff --git a/host/layer/public-webserver/dotfiles-setup.d.fish b/host/layer/public-webserver/dotfiles-setup.d.fish index 1b79105..189bce8 100644 --- a/host/layer/public-webserver/dotfiles-setup.d.fish +++ b/host/layer/public-webserver/dotfiles-setup.d.fish @@ -1,18 +1,19 @@ #!/usr/bin/env fish pushd (dirname (status -f)) -set dfp $argv[1] -set homedir $argv[2] -set xdgconfdir $argv[3] +# set dfp $argv[1] +# set homedir $argv[2] +# set xdgconfdir $argv[3] set layerdir (pwd) function _p - set source $argv[1] - set dest $argv[2] - sudo rm -rf "$dest" - echo "Copying $source to $dest" - sudo cp -r "$source" "$dest" + echo Copying $argv[1..-2] to $argv[-1] + sudo cp -r $argv[1..-2] $argv[-1] end +sudo rm -rf /etc/caddy _p $layerdir/caddy /etc/caddy -_p $layerdir/webserver-root /srv/http + +sudo mkdir -p /srv/http +sudo chmod 755 /srv/http +_p $layerdir/webserver-root/* /srv/http diff --git a/host/layer/public-webserver/webserver-root/404.html b/host/layer/public-webserver/webserver-root/404.html new file mode 100644 index 0000000..cc308dc --- /dev/null +++ b/host/layer/public-webserver/webserver-root/404.html @@ -0,0 +1,16 @@ + + + + + + + 404 Not Found + + +
+

404 - File Not Found 😢

+ +

Go to Index

+
+ + diff --git a/host/layer/public-webserver/webserver-root/index.html b/host/layer/public-webserver/webserver-root/index.html index e7efd73..c801776 100644 --- a/host/layer/public-webserver/webserver-root/index.html +++ b/host/layer/public-webserver/webserver-root/index.html @@ -1,6 +1,22 @@ - - Public Web lyte.dev Machine - - - Public Files - \ No newline at end of file + + + + + + + {{ .Host }} - Index + + +
+

Welcome to The Index at {{ .Host }}

+ +

+ If you wandered here by accident, you are either lost and in need of context, are looking for a particular file, or are just exploring. +

+ +

Whatever your adventure, welcome!

+ +

View {{ .Host }} Public Files

+
+ +