反向代理+内网穿透
实现通过公网域名或ip访问内网服务
要求
云服务器一台
在云服务器和本机上安装Frp实现内网穿透
步骤
SwitchHost(工具),配置服务器的ip及自定义域名
Frp配置
服务端(修改frps.ini)
bind_port = 7001
dashboard_port = 7500
token = 12345678
dashboard_user = admin
dashboard_pwd = admin
vhost_http_port = 88
运行服务端Frp(在文件夹下终端命令)
./frps -c frps.ini
客户端(本机frpc.ini)
可能的错误
The page you visit not found.
Sorry, the page you are looking for is currently unavailable.
Please try again later.
The server is powered by frp.
Faithfully yours, frp.
在frpc.ini中,custom_domains对应的我看有人让叫写ip,但是我在这样之后显示上述错误,修改成mall.com之后正常。
还有一个我记得是在配置的全部访问的时候(frps_full.ini)bind_addr = 0.0.0.0有可能是要写成
bind_addr = 0.0.0.0/0
server {
listen 80;
listen [::]:80;
server_name mall.com;
#charset koi8-r;
#access_log /var/log/nginx/log/host.access.log main;
location /static/ {
root /usr/share/nginx/html;
}
}
location / {
proxy_set_header Host $host;
proxy_pass http://服务器的ip:88;
}
error_page 404 /404.html;
location = /50x.html {
root /user/share/nginx/html;
}
}
小结
要是有什么问题可以留言交流