# Frps服務端一鍵安裝腳本
參考網址:
[https://blog.csdn.net/Inke88/article/details/76677956](https://blog.csdn.net/Inke88/article/details/76677956)
### **注意事項:記得給使用的端口開放防火墻,開放防火墻,開放防火墻**
案例:
放開的端口號:6443、5334、9980
Frps服務端一鍵配置腳本地址:[https://github.com/MvsCode/frps\-onekey](https://github.com/MvsCode/frps-onekey)
腳本有兩個源,國外VPS可以用Github的源,國內的VPS建議使用Aliyun的源,要不可能很慢。本教程使用的就是Aliyun的源
~~~bash
#下載腳本
wget https://code.aliyun.com/MvsCode/frps-onekey/raw/master/install-frps.sh -O ./install-frps.sh
#設置腳本運行權限
chmod 700 ./install-frps.sh
#執行腳本
./install-frps.sh install
#卸載
./install-frps.sh uninstall
#管理
/etc/init.d/frps start
/etc/init.d/frps stop
/etc/init.d/frps restart
/etc/init.d/frps status
/etc/init.d/frps config
/etc/init.d/frps version
~~~
github地址:
### https://github.com/fatedier/frp
客戶端下載地址:
[Releases · fatedier/frp · GitHub](https://github.com/fatedier/frp/releases)
1、選擇源,1是Aliyun,2是Github。我們選1

2、選擇服務端口。默認是5443。這個端口的作用是在客戶端連接服務端時是通過這個端口連接的。可以不用修改

3、設置http連接的端口。默認80,沒有被占用就默認

4、設置https連接的端口。默認443,沒有被占用就默認

5、設置面板的端口。直接用默認端口6443

6、設置登錄面板的用戶名和密碼,根據個人喜好設置


7、設置token。客戶端需要填寫的

8、設置域名,如果有就填寫,沒有就默認IP

**其他的配置就默認就好**
安裝好之后可以通過 frps config 指令修改或者查看配置。所以忘記了不怕
9、啟動服務
~~~text
frps start
~~~
最后,在瀏覽器中輸入[http://ip:6443](http://ip:6443/)。如果打不開,請看看是不是VPS的防火墻沒有開放6443端口。
如果成功就能看到如下的界面

### 啟動服務端 frps:
~~~
./frps -c ./frps.ini
~~~
查看`frp`進程
~~~
ps -aux | grep frp
~~~
### **客戶端配置文件:**
**frpc.ini**
~~~
[common]
# 服務器地址
server_addr =192.168.0.0
# 服務器端口
server_port = 5443
# 服務器連接憑證
token = otkentiejsdlfasdl;f
[web01]
type = http
local_port = 80
remote_port = 9980
custom_domains = a.frp.baidu.com
host_header_rewrite = bd.cc
[web02]
type = http
local_port = 80
remote_port = 9980
custom_domains = b.frp.baidu.com
host_header_rewrite = localhost
[web02_port]
type = http
local_ip = 127.0.0.1
local_port = 8686
remote_port = 9980
custom_domains = ha.frp.aaa.com
~~~
**Nginx端口映射:**
修改服務器的nginx配置:
~~~
map $http_x_forwarded_for $clientRealip {
"" $remote_addr;
~^(?P<firstAddr>[0-9\.]+),?.*$ $firstAddr;
}
server {
listen 80;
server_name frp.baidu.com *.frp.baidu.com;
location / {
proxy_pass http://127.0.0.1:9980; #此處的9980就是你安裝frp時設置的vhost_http_port端口
proxy_set_header Host $host;
proxy_set_header X-Real-IP $clientRealip; # $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
~~~
- thinkphp
- thinkphp筆記
- 后臺登陸退出
- config配置
- 隱藏后臺模塊
- 單獨調用騰訊云行為驗證碼
- api接口跨域問題
- api接口創建案例代碼
- 使用gateway worker
- 使用swoole代碼筆記
- 使用隊列 think-queue筆記
- 后臺布局
- MySQL
- 1、關于lnmp mysql的一個坑
- 2、mysql實現group by后取各分組的最新一條
- 其他
- 搞笑的注釋代碼
- 分頁類
- nodejs 打包網址為exe
- 免費天氣預報API接口
- Ajax
- 簡單的ajax分頁1
- 通用ajax-post提交
- 引用的類庫文件
- Auth.php
- Auth.php權限控制對應的數據庫表結構
- Layui.php
- Pinyin.php
- Random.php
- Tree.php
- Tree2.php
- Js-Jq
- Git的使用
- 3、bootstrap-datetimepicker實現兩個時間范圍輸入
- CentOS安裝SSR做梯子
- Python爬蟲
- 1、安裝Gerapy
- 2、安裝Scrapy
- 3、Scrapy使用
- 4、Scrapy框架,爬取網站返回json數據(spider源碼)
- 0、Python pip更換國內源(一句命令換源)
- 服務器運維
- 1、寶塔使用webhook更新服務器代碼
- 2、搭建內網穿透
- 3、數據庫主從同步
- 4、數據庫復制
- hui-Shop問題
- 1、前端模板的注意事項
- 2、模板標簽