frps.ini (konfigurasi pelayan)
[common] bind_port = 5443 kcp_bind_port = 5443 vhost_http_port = 8080 vhost_https_port = 4443 # frp的服务器指示面板配置 admin_addr = frp.test.com dashboard_port = 6443 dashboard_user = test dashboard_pwd = test log_file = ./frps.log # trace, debug, info, warn, error log_level = info log_max_days = 3 # auth token 可自主生成一些字符串 token = sfsfgsdgsdgsgddgsg tcp_mux = true max_pool_count = 50 # 用户自定义域名 subdomain_host = frp.test.com
frpc.ini (konfigurasi pelanggan)
[common] # 远程服务器ip地址 server_addr = 8.8.8.8 server_port = 5443 token = sfsfgsdgsdgsgddgsg tls_enable = true [lede] type = http local_ip = 10.10.10.1 local_port = 80 # 这里的值最终会被解析为lede.frp.test.com(需要在你的域名服务器做指向你自己公网服务器的*.frp.test.com的 # 域名泛解析) subdomain = lede use_encryption = false use_compression = true # http基础认证可以不填写 http_user = test http_pwd = test
vhosts.conf (konfigurasi nginx)
server { listen 80; listen 443 ssl http2; ssl_certificate /usr/local/nginx/conf/ssl/lede.frp.test.com.crt; ssl_certificate_key /usr/local/nginx/conf/ssl/lede.frp.test.com.key; ssl_protocols tlsv1 tlsv1.1 tlsv1.2; ssl_ciphers eecdh+chacha20:eecdh+aes128:rsa+aes128:eecdh+aes256:rsa+aes256:eecdh+3des:rsa+3des:!md5; ssl_prefer_server_ciphers on; ssl_session_timeout 10m; ssl_session_cache builtin:1000 shared:ssl:10m; ssl_buffer_size 1400; add_header strict-transport-security max-age=15768000; ssl_stapling on; ssl_stapling_verify on; server_name lede.frp.okuka.com; access_log /data/wwwlogs/lede.frp.test.com_nginx.log combined; if ($ssl_protocol = "") { return 301 https://$host$request_uri; } location / { proxy_pass http://127.0.0.1:8080;#端口号一定要和frps.ini的vhost_http_port一致 proxy_set_header host $host; proxy_set_header x-real-ip 8.8.8.8;#这里填写你的公网服务器ip proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; } }
Perhatian! ! ! ! ! Operasi di atas memerlukan memulakan semula perkhidmatan sebelum anda boleh menggunakannya
Atas ialah kandungan terperinci Bagaimana untuk mengkonfigurasi Frp untuk memaksa ubah hala ke https di bawah Nginx. Untuk maklumat lanjut, sila ikut artikel berkaitan lain di laman web China PHP!