腾讯云搭建Cpolar内网穿透
生活随笔
收集整理的這篇文章主要介紹了
腾讯云搭建Cpolar内网穿透
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
前言:此過程需要建立在購買了騰訊云以及cpolar內網穿透的前提下,騰訊云系統是centos7.6,cpolar內網穿透是購買的一年99塊的,可以自己自定義域名
一、安裝cpolar
國內用戶使用:
curl -L https://www.cpolar.com/static/downloads/install-release-cpolar.sh | sudo bash國外用戶使用:
curl -sL https://git.io/cpolar | sudo bash安裝完成之后,輸入下面代碼,查看是否安裝成功
cpolar version如果顯示這個,則證明安裝成功
二、cpolar進行token驗證
token值在cpolar個人登陸 --> 驗證
cpolar authtoken xxxxxxx三、編寫配置文件
編輯配置文件
vim /usr/local/etc/cpolar/cpolar.yml #代表注釋# 設置的token值 authtoken: xxxxxxxxxxxxxxxxxxxxxxxx# 通道信息 tunnels:# 配置ssh連接通道,通過ssh我們可以通過域名連接這臺電腦ssh:# 配置傳輸協議proto: tcp# 配置端口號addr: "22"# 配置地區,一般為cn_vip即可,有需求自己可以去官網上面查:https://www.cpolar.comregion: cn_vip# 配置第二個連接通道,開放8080是為了訪問到我們本地的tomcat服務器website:# 配置傳輸協議proto: http# 配置端口號addr: "8080"# 配置地區region: cn_vip# 配置二級子域名(要錢的,都算在套餐里面,一年99塊)subdomain: xxxxxx# 配置mysql數據庫連接通道 mysql:# 配置傳輸協議proto: tcp# 配置端口號addr: "3306"# 配置地區region: cn_vip# 配置redis緩存連接通道redis:# 配置傳輸協議proto: tcp# 配置端口號addr: "6379"# 配置地區region: cn_vip下面是沒有注釋的,直接拿來食用即可,配置了22端口(ssh鏈接),8080端口(tomcat服務器),3306端口(mysql),6379端口(redis),大家根據自己需求進行配置就行了
authtoken: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx tunnels:ssh:proto: tcpaddr: "22"region: cn_vipwebsite:proto: httpaddr: "8080"region: cn_vipsubdomain: xxxxxxmysql:proto: tcpaddr: "3306"region: cn_vipredis:proto: tcpaddr: "6379"region: cn_vip配置完成之后,按esc,輸入英文冒號:,之后出去wq,敲回車即可保存退出
或者直接按住shift+兩下Z即可保存退出
四、啟動服務
開啟cpolar服務
systemctl start cpolar停止cpolar服務
systemctl stop cpolar重啟cpolar服務
systemctl restart cpolar查看當前cpolar服務的狀態
systemctl status cpolar設置cpolar服務開機自啟動
systemctl enable cpolar上面的命令大家熟悉即可,必須要做的是開機自啟動,之后我們進行重啟服務器即可
sudo reboot之后在cpola個人主頁的狀態中就可以看到我們在線的隧道了
注:在我們配置website隧道中,端口寫的是8080,但是最后因為我們是http協議的,所以最后直接拿80端口訪問,最后會分配到主機的8080端口,簡而言之就是我們不用拿8080端口去訪問服務器
總結
以上是生活随笔為你收集整理的腾讯云搭建Cpolar内网穿透的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 心理测评软件的心理测试法的优缺点,心理测
- 下一篇: C语言标准输入输出缓冲区