- A+
frp中文帮助站点:https://github.com/fatedier/frp/blob/master/README_zh.md
服务器各版本下载:https://github.com/fatedier/frp/releases
我选择了32位系统所以下载的是frp_0.14.1_linux_386.tar.gz
地址:https://github.com/fatedier/frp/releases/download/v0.14.1/frp_0.14.1_linux_386.tar.gz
1、下载
wget https://github.com/fatedier/frp/releases/download/v0.14.1/frp_0.14.1_linux_386.tar.gz
2、解压
tar zxvf frp_0.14.1_linux_386.tar.gz
3、进入目录
cd frp_0.14.1_linux_386
修改配置文件frps.ini:
[common]
bind_port = 7000
vhost_http_port = 8080
dashboard_port = 7500
dashboard_user = admin
dashboard_pwd = admin #可以更改为你自己的密码
即使用了VPS的8080端口作为转发端口
4、启动frps:
./frps -c ./frps.ini
如果要自启动可以这样设置,把启动程序的命令添加到/etc/rc.d/rc.local文件中如下:
7、可以使用www.leiuu.com:8080访问网站了,如果想隐藏端口号,请配置vps的nginx服务器反代理即可(注意红色区域改为你自己的域名和IP地址):
server{
listen 80;
server_name www.leiuu.com *.leiuu.com;
index index.php index.html index.htm default.php default.htm default.html;
root /www/wwwroot/www.leiuu.com;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for;
proxy_set_header Host $http_host:8080;
proxy_set_header X-Nginx-Proxy true;
proxy_set_header Connection "";
proxy_pass http://127.0.0.1:8080;}
access_log /www/wwwlogs/ 56.224.153.111.log;
}
--------------------分割线----------------------如果上面的配置无法代理,可以试一下第二种------------
server { listen 80; server_name www.leiuu.com *.leiuu.com; location / { proxy_pass http://127.0.0.1:8080; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_max_temp_file_size 0; proxy_redirect off; proxy_read_timeout 240s; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } }
-----------------------------分割线----------------------------
8、如果是kangle服务器,使用www.leiuu.com:8080访问网站想隐藏端口号,可以这样设置:
第一步,进入kangle服务器http://IP:3311,点击左侧的“扩展”菜单,接着点击【单节点服务器】,添加一个名字为:127.0.0.1,协议选择http,主机地址为127.0.0.1,端口号为8080的单节服务器。
第二步,点击左侧“虚拟主机”菜单,接着点击“default”虚拟主机,再次点击【扩展映射】,在下面的下拉列表中选择"路径",然后在右边文本框中输入一个"/",即一个反斜杠,在“扩展”选项中选择你上一步新建的单节点服务器“服务器:127.0.0.1”,把“确认文件存在”右边的复选框√去掉,下面的“允许方法”默认填写一个星号不用更改。最后点击增加按钮即可。
写在最后,如果执行Frpc的时候提示authorization timeout错误,可能的原因是你的客户机和服务器VPS时间不一致,请同步一致就可以解决这个问题啦~!