一(yi)、安(an)裝(zhuang)環境
服務(wu)器(qi)
centos 6.8 64位
已安(an)裝(zhuang)gcc(如果沒安(an)裝(zhuang),在(zai)下面的(de)步驟要安(an)裝(zhuang))
微信(xin)開髮(fa)需要80端口,用(yong)于(yu)微信(xin)開髮(fa)的(de)話(hua)80端口不能(néng)有(yǒu)其他(tā)程(cheng)序使用(yong)(nginx,apache等(deng))
客戶(hu)端
win10 64位
二、安(an)裝(zhuang)步驟
1、安(an)裝(zhuang)git
yum install git
2、安(an)裝(zhuang)go
下載go1.4.2.linux-amd64.tar.gz
解壓
mv go /usr/local/
ln -s /usr/local/go/bin/* /usr/bin/
vi /etc/profile
#go langexport GOROOT=/usr/local/goexport PATH=$PATH:$GOROOT/bin
使環境變量生(sheng)效:
source /etc/profile
檢(jian)查昰(shi)否安(an)裝(zhuang)成(cheng)功:
go version
3、ngrok
cd /usr/local/src
git clone https://github.com/inconshreveable/ngrok.git
cd ngrokopenssl genrsa -out rootCA.key 2048openssl req -x509 -new -nodes -key rootCA.key -subj "/CN=ngrok.qizhan100.com" -days 5000 -out rootCA.pemopenssl genrsa -out device.key 2048openssl req -new -key device.key -subj "/CN=ngrok.qizhan100.com" -out device.csropenssl x509 -req -in device.csr -CA rootCA.pem -CAkey rootCA.key -CAcreateserial -out device.crt -days 5000
cp rootCA.pem assets/client/tls/ngrokroot.crtcp device.crt assets/server/tls/snakeoil.crtcp device.key assets/server/tls/snakeoil.key
4、編譯服務(wu)端
設(shè)置變量:
GOOS=linux GOARCH=amd64 #如果昰(shi)32位係(xi)統,這裏 GOARCH=386
生(sheng)成(cheng)服務(wu)端與客戶(hu)端
make release-server release-client
5、編譯客戶(hu)端
cd /usr/local/go/src/GOOS=windows GOARCH=amd64 CGO_ENABLED=0 ./make.bash
因爲(wei)客戶(hu)端要在(zai)windows下運行,所以(yi)這裏指定os爲(wei)windows編譯,linux係(xi)統GOOS=linux,64位係(xi)統GOARCH=amd64,32位係(xi)統GOARCH=386
cd /usr/local/src/ngrok/GOOS=windows GOARCH=amd64 make release-server release-client
啓動(dòng)服務(wu)
bin/ngrokd -domain="ngrok.qizhan100.com" -httpAddr=":80"
其他(tā)
注意記得開放ngrok.cfg配(pei)置文(wén)件對應的(de)端口4443
- 版權所有(yǒu):奇站網絡 轉載請(qing)注明出處
- 廈們(men)奇站網絡科(ke)技(ji)有(yǒu)限(xian)公(gōng)司,專(zhuan)業提供網站建(jian)設(shè),響應式(shi)網站建(jian)設(shè),小(xiǎo)程(cheng)序開髮(fa),係(xi)統定製(zhi)開髮(fa)。
- 軟件開髮(fa)咨詢熱線(xiàn):吳小(xiǎo)姐 13313868605
