-
-
Save nshtg/0371c343efe7ad0bc0c75bb60d7bf7ac to your computer and use it in GitHub Desktop.
Install Caddy Server on Centos 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
useradd www-data --system || true | |
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 -p /etc/caddy | |
chown -R root:www-data /etc/caddy | |
mkdir -p /etc/ssl/caddy | |
chown -R www-data:root /etc/ssl/caddy | |
chmod 770 /etc/ssl/caddy | |
touch /etc/caddy/Caddyfile | |
mkdir -p /var/www | |
chown www-data:www-data /var/www | |
chmod 755 /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/" | sed "s/Wants=network-online.target systemd-networkd-wait-online.service/Wants=network-online.target/" | tee /etc/systemd/system/caddy.service | |
chown root:root /etc/systemd/system/caddy.service | |
chmod 744 /etc/systemd/system/caddy.service | |
systemctl daemon-reload | |
systemctl enable caddy.service | |
# systemctl start caddy.service |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment