-
-
Save Lockyc/8d0b0e8421c88c44cc796c1e7714d6b9 to your computer and use it in GitHub Desktop.
Install Caddy Server on Ubuntu with Systemd.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run as root please | |
apt install curl | |
curl -L https://getcaddy.com | bash -s http.awslambda,http.cgi,http.cors,http.expires,http.filemanager,http.filter,http.git,http.hugo,http.ipfilter,http.jwt,http.mailout,http.minify,http.prometheus,http.proxyprotocol,http.ratelimit,http.realip,http.upload,dns,net,hook.service | |
chown root:root /usr/local/bin/caddy | |
chmod 755 /usr/local/bin/caddy | |
setcap 'cap_net_bind_service=+ep' /usr/local/bin/caddy | |
mkdir /etc/caddy | |
chown -R root:www-data /etc/caddy | |
mkdir /etc/ssl/caddy | |
chown -R www-data:root /etc/ssl/caddy | |
chmod 0770 /etc/ssl/caddy | |
touch /etc/caddy/Caddyfile | |
mkdir /var/www | |
chown www-data:www-data /var/www | |
chmod 555 /var/www | |
# if you run plugins which creates new process (e.g. hugo), 64 is not enough and causes server crash; see https://github.com/hacdias/caddy-hugo/issues/96 | |
curl -L https://github.com/mholt/caddy/raw/master/dist/init/linux-systemd/caddy.service | sed "s/LimitNPROC=64/LimitNPROC=128/" | tee /etc/systemd/system/caddy.service | |
chown root:root /etc/systemd/system/caddy.service | |
chmod 744 /etc/systemd/system/caddy.service | |
systemctl daemon-reload | |
sudo systemctl enable caddy.service |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment