more proper default index.html

This commit is contained in:
AJ ONeal 2017-04-21 00:07:28 -06:00
parent 61184059a4
commit 41fbc5f94b
2 changed files with 68 additions and 12 deletions

View File

@ -7,6 +7,7 @@ installer_base="https://git.daplie.com/Daplie/caddy-installer/raw/master"
caddy_systemd_service="$installer_base/etc/systemd/system/caddy.service"
caddy_systemd_tmpfiles="$installer_base/etc/tmpfiles.d/caddy.conf"
caddy_launchd_service="$installer_base/Library/LaunchDaemons/com.caddyserver.web.plist"
caddy_localhost_index="$installer_base/srv/www/index.html"
all_oses="windows,darwin,linux,freebsd,openbsd"
all_arches="arm64,amd64,386,armv5,armv6l,armv7l"
@ -320,18 +321,10 @@ CADDY_EOF
$sudo_cmd chmod 755 $PREFIX/srv/www/localhost
if [ ! -f "$PREFIX/srv/www/localhost/index.html" ] || [ -z "$(cat $PREFIX/srv/www/localhost)" ]; then
cat <<'CADDY_EOF' >> $PREFIX/tmp/$caddy_dir/index.html
<!DOCTYPE html>
<html>
<head>
<title>Welcome to Caddy!</title>
</head>
<body>
<h1>Welcome to Caddy!</h1>
</body>
</html>
CADDY_EOF
$sudo_cmd mv "$PREFIX/tmp/$caddy_dir/index.html" "$PREFIX/srv/www/localhost/index.html"
$http_get $http_opts "$caddy_localhost_index" $http_out $PREFIX/tmp/$caddy_dir/index.html
$sudo_cmd mv $PREFIX/tmp/$caddy_dir/index.html $PREFIX/srv/www/localhost/
$sudo_cmd chown -R $caddy_user:$caddy_group $PREFIX/srv/www/localhost/
$sudo_cmd chmod 664 $PREFIX/srv/www/localhost/index.html
fi
if setcap_cmd=$(type -p setcap); then

63
srv/www/index.html Normal file
View File

@ -0,0 +1,63 @@
<!DOCTYPE html>
<html>
<head>
<title>Welcome to Caddy!</title>
</head>
<body>
<h1>Welcome to Caddy!</h1>
<p>Here's some info to help you know what to do next</p>
<h2>Where do my sites go?</h2>
<p>
Your sites are in <kbd>/srv/www</kbd>. In fact, this page is served from <kbd>/srv/www/localhost/index.html</kbd>
</p>
<p>
If you have a site, say example.com, you can put it in <kbd>/srv/www/example.com</kbd> and then edit the Caddyfile
to reflect the change:
</p>
<pre><code>https://example.com {
tls john@email.com
root /srv/www/example.com
}
https://www.example.com {
redir https://example.com
}
</code></pre>
<h2>What was installed to where?</h2>
<pre><code>/usr/local/bin/caddy
/etc/caddy/Caddyfile
/etc/ssl/caddy/
/etc/ssl/caddy/acme/
/etc/ssl/caddy/ocsp/
/etc/systemd/system/caddy.service
/etc/tmpfiles.d/caddy.conf
/srv/www/localhost/index.html
/var/log/caddy/
/Library/LaunchDaemons/com.caddyserver.web.plist
</code></pre>
<h2>How do I start / stop / reload / see logs for Caddy?</h2>
<table>
<tr>
<th>Windows</th>
<td>Mac</td>
<td>Linux</td>
</tr>
<tr>
<td>The world may never know...</td>
<td><pre><code>launchctl unload com.caddyserver.web
launchctl load -w com.caddyserver.web
launchctl list | grep caddy
launchctl remove grep caddy
</code></pre></td>
<td><pre><code>systemctl status caddy
systemctl enable caddy
systemctl start caddy
systemctl stop caddy
journalctl --boot -u caddy.service
</code></pre></td>
</tr>
</table>
</body>
</html>