使用holer访问,并且nginx与fcgi的搭建都是在下面这边文章当中
https://blog.csdn.net/qq_40282557/article/details/116161550
现在就是使用frp进行内网穿透
1、工具准备
(1)服务器,本文使用的是腾讯云服务器
(2)一个域名,解析到服务器地址
(3)frp的两个包,也就是服务器运行和本地的运行的
下载地址为
https://github.com/fatedier/frp/releases/
服务器建议用下面代码方式进行下载
wget https://github.com/fatedier/frp/releases/download/版本/架构
2、配置文件
2.1配置frps.ini
[common]
#客户端连接的端口
bind_port = 7000
vhost_http_port = 6001#这就是http访问时的端口
subdomain_host = www.*********#自己的域名
2.2配置frpc.ini
[common]
server_addr = www.*******
server_port = 7000#要和frps.ini一致
[ssh]#ssh连接的方式
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 6000
[http]
#连接方式 http
type = http
#内网服务器地址
#local_ip = 192.168.0.199
local_ip = 127.0.0.1
#内网服务器端口
local_port = 80#主要是端口一定要配置好
#外网的域名
custom_domains = www.**********
2.3配置nginx
打开文件nginx.conf
默认在/usr/local/nginx/conf
下面添加sever为
server {
listen 80;
server_name www.**********;
location ~ \.cgi$ {
fastcgi_pass 127.0.0.1:8088;
fastcgi_index index.cgi;
fastcgi_param SCRIPT_FILENAME fcgi$fastcgi_script_name;
include fastcgi_params;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
3、启动服务
3.1在服务器上运行
运行frps
./frps -c ./frps.ini
3.1在客户端运行
(1)运行fcgi
/usr/local/nginx/sbin/spawn-fcgi -a 127.0.0.1 -p 8088 -f /usr/local/nginx/sbin/fcgi
(2)重启nginx
sudo ./nginx -s reload
(3)运行frpc
./frpc -c ./frpc.ini
服务器端的运行情况:
客户端运行情况:
输入
域名+端口号+fcgi程序
即可进行访问
在服务器一直运行的命令:
服务端: nohup ./frps -c frps.ini >/dev/null 2>&1 &
客户端: nohup ./frpc -c frpc.ini >/dev/null 2>&1 &
说明:>/dev/null 2>&1 &,表示丢弃。