Quick & Easy: Caddy http/2 web server with a twist

someone recommended this one to me the other day, its fantastic, it has built in git, search, simpler config (that you can remember)

it can automatically get lets encrypt certificates and it can render markdown to html on the fly

Find it at caddyserver.com or on github

Install caddy (linux)
curl https://getcaddy.com | bash

Install caddy (Windows)
https://caddyserver.com/download/windows/amd64

to get port 80 to work
setcap cap_net_bind_service=+ep /usr/local/bin/caddy

serve content from current directory and list the content
caddy browse @ http://localhost:2015

serve content from current directory with username and password and list the content
caddy "basicauth / username password" "browse"

serve markdown as html
caddy "markdown"

serve gipzed content on the fly
caddy "gzip"

self signed ssl
caddy "tls self_signed"

serve content from /var/www
caddy -root /var/www

everything put into a Caddyfile

localhost {
tls self_signed
root /var/www
basicauth / user pass
browse
markdown 
gzip
}

now you can run it
caddy or caddy -conf "/path/to/Caddyfile"

bonus round

change localhost with domain.com and add tls your@email.com inside } to get certificates automatically

to serve php5 you add fastcgi / /var/run/php5-fpm.sock php inside }
to serve php7 you add fastcgi / /var/run/php7-fpm.sock php inside }
to serve php7.1 you add fastcgi / /var/run/php7.1-fpm.sock php inside }

reverse proxy to ghost with ssl

domain.com {
    tls my@mail.ninja
    proxy / localhost:2368 {
        proxy_header Host {host}
        proxy_header X-Real-IP {remote}
        proxy_header X-Forwarded-Proto {scheme}
    }
}