github.com/linapex/ethereum-go-chinese@v0.0.0-20190316121929-f8b7a73c3fa1/cmd/puppeth/wizard_nginx.go (about) 1 2 //<developer> 3 // <name>linapex 曹一峰</name> 4 // <email>linapex@163.com</email> 5 // <wx>superexc</wx> 6 // <qqgroup>128148617</qqgroup> 7 // <url>https://jsq.ink</url> 8 // <role>pku engineer</role> 9 // <date>2019-03-16 19:16:33</date> 10 //</624450070162444288> 11 12 13 package main 14 15 import ( 16 "fmt" 17 18 "github.com/ethereum/go-ethereum/log" 19 ) 20 21 //确保revirtualhost检查是否在指定的 22 // 23 // 24 // 25 // 26 // 27 func (w *wizard) ensureVirtualHost(client *sshClient, port int, def string) (string, error) { 28 proxy, _ := checkNginx(client, w.network) 29 if proxy != nil { 30 //反向代理正在运行,如果端口匹配,我们需要一个虚拟主机 31 if proxy.port == port { 32 fmt.Println() 33 fmt.Printf("Shared port, which domain to assign? (default = %s)\n", def) 34 return w.readDefaultString(def), nil 35 } 36 } 37 // 38 fmt.Println() 39 fmt.Println("Allow sharing the port with other services (y/n)? (default = yes)") 40 if w.readDefaultYesNo(true) { 41 nocache := false 42 if proxy != nil { 43 fmt.Println() 44 fmt.Printf("Should the reverse-proxy be rebuilt from scratch (y/n)? (default = no)\n") 45 nocache = w.readDefaultYesNo(false) 46 } 47 if out, err := deployNginx(client, w.network, port, nocache); err != nil { 48 log.Error("Failed to deploy reverse-proxy", "err", err) 49 if len(out) > 0 { 50 fmt.Printf("%s\n", out) 51 } 52 return "", err 53 } 54 //已部署反向代理,请再次请求虚拟主机 55 fmt.Println() 56 fmt.Printf("Proxy deployed, which domain to assign? (default = %s)\n", def) 57 return w.readDefaultString(def), nil 58 } 59 // 60 return "", nil 61 } 62