• 本帖最后由 darkt 于 2018-11-28 13:35 编辑 *

目的:内网搭建了web 服务利用frp 实现外网访问

VPS 搭建了frps服务 因80和443 端口被nginx占用 查到资料说利用反代可以解决

VPS frps http 端口8080 https 端口4433

VPS安装了宝塔,这是我的nginx 新加的 配置:

在nginx.conf中http{ }里添加以下参数:

  • server
  • {
  • - listen 80;
  • server_name *.isays.cn;
  • #frp proxy
  • location / {
  • proxy_pass http://8080;
  • proxy_redirect off;
  • proxy_set_header X-Real-IP $remote_addr;
  • proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  • proxy_set_header Host $host:$server_port;
  • }
  • - }
  • - server
  • {
  • - listen 443;
  • server_name *.isays.cn;
  • #SSL
  • ssl_certificate /www/server/nginx/conf/vhost/isays.cn.cer;
  • ssl_certificate_key /www/server/nginx/conf/vhost/isays.cn.key;
  • ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  • ssl_ciphers TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:TLS13-AES-128-CCM-8-SHA256:TLS13-AES-128-CCM-SHA256:EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
  • ssl_prefer_server_ciphers on;
  • ssl_session_cache shared:SSL:10m;
  • ssl_session_timeout 10m;
  • location / {
  • proxy_pass https://4433;
  • proxy_redirect off;
  • proxy_set_header X-Real-IP $remote_addr;
  • proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  • proxy_set_header X-Forwarded-Proto $scheme;
  • proxy_set_header Host $host:$server_port;
  • }
  • }复制代码

但是结果是访问https://zooo.isays.cn 显示502 http://zooo.isays.cn 也访问不了

内网路由器里的frpc 配置

  • type = https
  • local_ip = 10.0.0.182
  • local_port = 443
  • subdomain = zooo复制代码