centos 配置 Caddy

2019-05-14

DNS 解析修改指向 服务器源 IP

image

修改 caddy 配置文件

> /etc/caddy/Caddyfile



:80 
{

     redir  https://域名{uri} 
 
    gzip
}



https://域名
{
  
    tls /etc/caddy/my.crt /etc/caddy/my.key {
        ca /etc/caddy/ca.crt
           

    }

    gzip {
        not  /sync /ct /js /css
    }

timeouts none
basicauth "root" passwd1 {
    realm "Mary Lou's documents"
    /ct
   
}
    proxy / https://npm.taobao.org {
        except /mirrors /ct /js /css /sync /template /api
    }
    # rewrite /js /jsss
header / {
     X-Frame-Options "SAMEORIGIN" 
         X-XSS-Protection "1; mode=block" 
         X-Content-Type-Options "nosniff" 
         Referrer-Policy "no-referrer-when-downgrade" 
         Content-Security-Policy "default-src * data: 'unsafe-eval' 'unsafe-inline'" 
         Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" 
}

 header /sync {
        Cache-Control "no-cache"
        Content-Type "text/event-stream"
       
    }
    header /ct  {
Connection ""
        X-Accel-Buffering "no"
    }
    header /sync {
       Connection ""
        X-Accel-Buffering "no" 
    }
    proxy /ct 127.0.0.1:3001 {
# redir 127.0.0.1:3001
        # gzip off

                # proxy_header Host {host}
        without /ct  
        websocket
        transparent

        header_upstream X-Real-IP {remote}
    header_upstream X-Forwarded-Server {host}
    header_upstream X-Forwarded-Host {host}

    }
    proxy /api 127.0.0.1:3001 {
# redir 127.0.0.1:3001
        # gzip off

                # proxy_header Host {host}
        # without /ct  
        websocket
        transparent

        header_upstream X-Real-IP {remote}
    header_upstream X-Forwarded-Server {host}
    header_upstream X-Forwarded-Host {host}

    }
      proxy /js 127.0.0.1:3001 {
# redir 127.0.0.1:3001
        # gzip off

                # proxy_header Host {host}
        # without /js
        websocket
        transparent


    }
    proxy   /template  127.0.0.1:3001 {
# redir 127.0.0.1:3001
        # gzip off

                # proxy_header Host {host}
        # without /css

        # timeouts none
  header_upstream X-Real-IP {remote}
        header_upstream X-Forwarded-Server {host}
        header_upstream X-Forwarded-Host {host}
        # keepalive 1000
        websocket
        transparent


    }
      proxy /css 127.0.0.1:3001 {
# redir 127.0.0.1:3001
        # gzip off

                # proxy_header Host {host}
        # without /css

        # timeouts none
  header_upstream X-Real-IP {remote}
        header_upstream X-Forwarded-Server {host}
        header_upstream X-Forwarded-Host {host}
        # keepalive 1000
        websocket
        transparent


    }
          proxy /sync 127.0.0.1:3001 {
# redir 127.0.0.1:3001
        # gzip off
 

        # without /sync

        # timeouts none
  header_upstream X-Real-IP {remote}
        header_upstream X-Forwarded-Server {host}
        header_upstream X-Forwarded-Host {host}
        # keepalive 1000

        transparent
        websocket


    }
}
import sites/*

增加SSL证书

SSL 证书使用 cloudflare 生成的

image
使用 yummpy ftp pro 远程增删改
image