ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
自定义端口配置 ---------服务器端配置----------- 设置配置文件frps.ini ``` [common] bind_port = 7000 token = 12345678 ``` cd 到目录 //开始运行服务 ``` ./frps -c frps.ini ``` //结束运行 ``` ctrl+c ``` //创建服务器自动运行服务 ``` vi /lib/systemd/system/frps.service ``` //打开后编辑 i-------------- ``` [Unit] Description=fraps service After=network.target syslog.target Wants=network.target [Service] Type=simple ExecStart=/www/wwwroot/frp/frps -c /www/wwwroot/frp/frps.ini [Install] WantedBy=multi-user.target ``` //退出编辑 esc :wq------------------ //启动编辑后的服务 ``` systemctl start frps ``` //自动启动服务 ``` systemctl enable frps ``` //重启 ``` reboot ``` // 查看启动服务进程 ``` ps auxw ``` ---------服务器端配置 end----------- ---------本地服务器端配置----------- //设置配置文件frpc.ini ``` [common] server_addr = 39.107.238.6 server_port = 7000 token = 12345678 [6002] type = tcp local_ip = 127.0.0.1 local_port = 80 remote_port = 6002 ``` cd 到目录 //开始运行服务 ``` ./frpc -c frpc.ini ``` //创建服务器自动运行服务 ``` vi /lib/systemd/system/frpc.service ``` //打开后编辑 i-------------- ``` [Unit] Description=fraps service After=network.target syslog.target Wants=network.target [Service] Type=simple ExecStart=/www/wwwroot/frp/frpc -c /www/wwwroot/frp/frpc.ini [Install] WantedBy=multi-user.target ``` //退出编辑 esc :wq------------------ //启动编辑后的服务 ``` systemctl start frps ``` //自动启动服务 ``` systemctl enable frps ``` 对接后服务器配置域名80端口,本地服务器配置域名+remote_port = 6002端口 ======================================== 80端口 7500 frps.in ``` [common] bind_addr = 0.0.0.0 bind_port = 7000 bind_udp_port = 7001 kcp_bind_port = 7000 vhost_http_port = 8080 vhost_https_port = 8443 dashboard_addr = 0.0.0.0 dashboard_port = 7500 dashboard_user = admin enable_prometheus = true log_file = ./frps.log log_level = info log_max_days = 3 disable_log_color = false detailed_errors_to_client = true authentication_method = token authenticate_heartbeats = false authenticate_new_work_conns = false token = 12345678 max_pool_count = 5 max_ports_per_client = 0 tls_only = false subdomain_host = szysqt.lnlongyuan.cn tcp_mux = true custom_404_page = /path/to/404.html ``` ============ myfrpc.ini 80 ``` [common] server_addr = frp.szysqt.lnlongyuan.cn server_port = 7000 token = 12345678 [web1] type = http local_ip = 127.0.0.1 local_port = 80 subdomain = web [web2] type = https local_ip = 127.0.0.1 local_port = 443 subdomain = web ``` ------------------------------------ //nginx frps 服务端 #80端口好用 ``` server { listen 80; server_name frp.szysqt.lnlongyuan.cn; location / { proxy_pass http://127.0.0.1:8080; proxy_redirect http://$host/ http://$http_host/; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; } } ```