This is a creation in Article, where the information may have evolved or changed.
Caddy
Similar to Apache,nginx, is a high-performance HTTP and reverse proxy server
Code
Https://github.com/mholt/caddy
Use, first upgrade go to more than 1.9 (https://my.oschina.net/u/2601 ..., and then
go get github.com/mholt/caddy/caddygo get github.com/caddyserver/buildscd $GOPATH/src/github.com/mholt/caddy/caddygo run build.go./caddy
Initially try to create the Caddyfile file in the same directory as the caddy, write the configuration, and then run the Caddy
# cat Caddyfile0.0.0.0:2015pushbrowsewebsocket /echo catext .htmllog /var/log/access.logproxy /api 127.0.0.1:7005header /api Access-Control-Allow-Origin *# # ./caddyActivating privacy features... done.http://0.0.0.0:2015
Effect, ran a simple file server
To turn on HTTPS, you need to add a line configuration Tls/root/ca.pem/root/ca-key.pem,
# cat Caddyfile0.0.0.0:2015 { gzip tls /etc/ssl/caddy/ca.pem /etc/ssl/caddy/ca-key.pem #tls xxxx@qq.com { # protocols tls1.0 tls1.2 #} push browse websocket /echo cat ext .html log /var/log/access.log proxy /api 127.0.0.1:7005 header /api Access-Control-Allow-Origin *}# ./caddyActivating privacy features... done.https://0.0.0.0:2015
See a lot of posts said caddy can automatically apply for a certificate, but I tried many times did not succeed. The virtual machine outside the wall is not ...
Reverse proxy, simple configuration as follows, to the original Web services directly added HTTPS, very good.
0.0.0.0:2015 { gzip tls /root/ca.pem /root/ca-key.pem proxy / http://localhost:8080 { header_upstream Host {host} header_upstream X-Real-IP {remote} header_upstream X-Forwarded-For {remote} header_upstream X-Forwarded-Proto {scheme} }