其他分享
首页 > 其他分享> > frp配置http简化版

frp配置http简化版

作者:互联网

简化版配置
server配置,文件frps.ini

#frps.ini
[common]
bind_addr = 0.0.0.0
bind_port = 7000
kcp_bind_port = 7000
# if you want to support virtual host, you must set the http port for listening (optional)
# Note: http port and https port can be same with bind_port
vhost_http_port = 8700
vhost_https_port = 8443
# dashboard is available only if dashboard_port is set
dashboard_addr = 0.0.0.0
dashboard_port = 7500

# dashboard user and passwd for basic auth protect
dashboard_user = admin
dashboard_pwd = admin
# console or real logFile path like ./frps.log
log_file = ./frps.log

# trace, debug, info, warn, error
log_level = info

log_max_days = 3
# auth token
token = 12345678
# only allow frpc to bind ports you list, if you set nothing, there won't be any limit
; allow_ports = 2000-3000,3001,3003,4000-50000
# when subdomain is test, the host used by routing is test.frps.com
subdomain_host = frp.ministep.cn

启动

./frps -c frps.ini

服务端nginx配置

#frp.conf
# frp的接收http请求的反向代理
server {
	listen 80;
	server_name *.frp.ministep.cn;
	location / {
		# 7071端口即为frp监听的http端口
		proxy_pass http://127.0.0.1:8700; 
		proxy_set_header Host $host:80;
		proxy_set_header X-Real-IP $remote_addr;
		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		
		proxy_set_header Upgrade $http_upgrade;
		proxy_set_header Connection "upgrade";
		
		proxy_connect_timeout 7d;
		proxy_send_timeout 7d;
		proxy_read_timeout 7d;

		}
	# 防止爬虫抓取
	if ($http_user_agent ~* "360Spider|JikeSpider|Spider|spider|bot|Bot|2345Explorer|curl|wget|webZIP|qihoobot|Baiduspider|Googlebot|Googlebot-Mobile|Googlebot-Image|Mediapartners-Google|Adsbot-Google|Feedfetcher-Google|Yahoo! Slurp|Yahoo! Slurp China|YoudaoBot|Sosospider|Sogou spider|Sogou web spider|MSNBot|ia_archiver|Tomato Bot|NSPlayer|bingbot")
		{
			return 403;
		}
}

server {
    listen 80;
    server_name frp.ministep.cn;
    location / {
        proxy_pass http://127.0.0.1:7500;
        proxy_set_header    Host            $host:80;
        proxy_set_header    X-Real-IP       $remote_addr;
        proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_hide_header   X-Powered-By;
    }
}

nginx 强制更新

nginx -t
nginx -s reload

frp-client客户端配置

#frpc.ini
[common]
server_addr = 1.15.229.131
server_port = 7000
; auth_token = ministep
token = 12345678
[ssh]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 6000
[web]
type = https
local_ip = 127.0.0.1
local_port = 5000
use_encryption = false
use_compression = false
subdomain = flask
custom_domains = frp.ministep.cn

启动

./frpc -c frpc.ini

标签:set,http,简化版,header,frp,proxy,port
来源: https://www.cnblogs.com/ministep/p/15498985.html