Closed wudinaonao closed 5 years ago
这个我只知道,使用tcp转发各端口的话,可以跳转htts
您好,我最近刚接触Frp这款软件,有些地方还不是太懂。您说的tcp转发各端口具体指的是什么,方便的话可否告知具体如何操作。我理解的是外网输入域名,然后frps得到请求去连接frpc,然后本地web服务器得到请求并跳转到https协议,fprc返回frps,frps返回给浏览者https网页。 不胜感激!
问题已经解决!
我发现了问题的解决方案。
Frps配置保持不变,问题出在Frpc的配置上
我发现Http和https的名称同为[web] 是问题的原因,只要把http和https的名称改成不同的名字即可
例如我修改后的配置如下:
[common] server_addr = x.x.x.x server_port = 7000
[ssh] type = tcp local_ip = 127.0.0.1 local_port = 22 remote_port = 6000
[web01]
type = http
local_ip = 127.0.0.1
local_port = 80
custom_domains = www.wudinaonao.com
[web02]
type = https
local_ip = 127.0.0.1
local_port = 443
custom_domains = www.wudinaonao.com
这个没有注意到,我所谓的tcp是使用tcp而非web下的http,不用指定域名,只映射端口就行了。我也是新手,呵呵😄-------- 原始邮件 --------主题:Re: [fatedier/frp] 如何使用frp实现http重定向到https (#904)发件人:wudinaonao 收件人:fatedier/frp 抄送:thorisme ,Comment 问题已经解决! 我发现了问题的解决方案。 Frps配置保持不变,问题出在Frpc的配置上 我发现Http和https的名称同为[web] 是问题的原因,只要把http和https的名称改成不同的名字即可 例如我修改后的配置如下: [common] server_addr = 35.194.149.192 server_port = 7000 [ssh] type = tcp local_ip = 127.0.0.1 local_port = 22 remote_port = 6000 [web01] type = http local_ip = 127.0.0.1 local_port = 80 custom_domains = www.wudinaonao.com [web02] type = https local_ip = 127.0.0.1 local_port = 443 custom_domains = www.wudinaonao.com
—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or mute the thread. {"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/fatedier/frp","title":"fatedier/frp","subtitle":"GitHub repository","main_image_url":"https://assets-cdn.github.com/images/email/message_cards/header.png","avatar_image_url":"https://assets-cdn.github.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/fatedier/frp"}},"updates":{"snippets":[{"icon":"PERSON","message":"@wudinaonao in #904: 问题已经解决!\r\n\r\n我发现了问题的解决方案。\r\n\r\nFrps配置保持不变,问题出在Frpc的配置上\r\n\r\n我发现Http和https的名称同为[web] 是问题的原因,只要把http和https的名称改成不同的名字即可\r\n\r\n例如我修改后的配置如下:\r\n\r\n[common]\r\nserver_addr = 35.194.149.192\r\nserver_port = 7000\r\n\r\n\r\n[ssh]\r\ntype = tcp\r\nlocal_ip = 127.0.0.1\r\nlocal_port = 22\r\nremote_port = 6000\r\n\r\n[web01] \r\ntype = http \r\nlocal_ip = 127.0.0.1 \r\nlocal_port = 80 \r\ncustom_domains = www.wudinaonao.com \r\n\r\n[web02] \r\ntype = https \r\nlocal_ip = 127.0.0.1 \r\nlocal_port = 443 \r\ncustom_domains = www.wudinaonao.com \r\n\r\n"}],"action":{"name":"View Issue","url":"https://github.com/fatedier/frp/issues/904#issuecomment-416503197"}}} [ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/fatedier/frp/issues/904#issuecomment-416503197", "url": "https://github.com/fatedier/frp/issues/904#issuecomment-416503197", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } }, { "@type": "MessageCard", "@context": "http://schema.org/extensions", "hideOriginalBody": "false", "originator": "AF6C5A86-E920-430C-9C59-A73278B5EFEB", "title": "Re: [fatedier/frp] 如何使用frp实现http重定向到https (#904)", "sections": [ { "text": "", "activityTitle": "wudinaonao", "activityImage": "https://assets-cdn.github.com/images/email/message_cards/avatar.png", "activitySubtitle": "@wudinaonao", "facts": [
] } ], "potentialAction": [ { "name": "Add a comment", "@type": "ActionCard", "inputs": [ { "isMultiLine": true, "@type": "TextInput", "id": "IssueComment", "isRequired": false } ], "actions": [ { "name": "Comment", "@type": "HttpPOST", "target": "https://api.github.com", "body": "{\n\"commandName\": \"IssueComment\",\n\"repositoryFullName\": \"fatedier/frp\",\n\"issueId\": 904,\n\"IssueComment\": \"{{IssueComment.value}}\"\n}" } ] }, { "name": "Close issue", "@type": "HttpPOST", "target": "https://api.github.com", "body": "{\n\"commandName\": \"IssueClose\",\n\"repositoryFullName\": \"fatedier/frp\",\n\"issueId\": 904\n}" }, { "targets": [ { "os": "default", "uri": "https://github.com/fatedier/frp/issues/904#issuecomment-416503197" } ], "@type": "OpenUri", "name": "View on GitHub" }, { "name": "Unsubscribe", "@type": "HttpPOST", "target": "https://api.github.com", "body": "{\n\"commandName\": \"MuteNotification\",\n\"threadId\": 372898653\n}" } ], "themeColor": "26292E" } ]
感谢您的帮助!
发送自 Windows 10 版邮件https://go.microsoft.com/fwlink/?LinkId=550986应用
发件人: thorisme notifications@github.com 发送时间: Tuesday, August 28, 2018 10:11:36 PM 收件人: fatedier/frp 抄送: wudinaonao; Mention 主题: Re: [fatedier/frp] 如何使用frp实现http重定向到https (#904)
这个没有注意到,我所谓的tcp是使用tcp而非web下的http,不用指定域名,只映射端口就行了。我也是新手,呵呵😄-------- 原始邮件 --------主题:Re: [fatedier/frp] 如何使用frp实现http重定向到https (#904)发件人:wudinaonao 收件人:fatedier/frp 抄送:thorisme ,Comment 问题已经解决! 我发现了问题的解决方案。 Frps配置保持不变,问题出在Frpc的配置上 我发现Http和https的名称同为[web] 是问题的原因,只要把http和https的名称改成不同的名字即可 例如我修改后的配置如下: [common] server_addr = 35.194.149.192 server_port = 7000 [ssh] type = tcp local_ip = 127.0.0.1 local_port = 22 remote_port = 6000 [web01] type = http local_ip = 127.0.0.1 local_port = 80 custom_domains = www.wudinaonao.com [web02] type = https local_ip = 127.0.0.1 local_port = 443 custom_domains = www.wudinaonao.com
—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or mute the thread. {"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/fatedier/frp","title":"fatedier/frp","subtitle":"GitHub repository","main_image_url":"https://assets-cdn.github.com/images/email/message_cards/header.png","avatar_image_url":"https://assets-cdn.github.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/fatedier/frp"}},"updates":{"snippets":[{"icon":"PERSON","message":"@wudinaonao in #904: 问题已经解决!\r\n\r\n我发现了问题的解决方案。\r\n\r\nFrps配置保持不变,问题出在Frpc的配置上\r\n\r\n我发现Http和https的名称同为[web] 是问题的原因,只要把http和https的名称改成不同的名字即可\r\n\r\n例如我修改后的配置如下:\r\n\r\n[common]\r\nserver_addr = 35.194.149.192\r\nserver_port = 7000\r\n\r\n\r\n[ssh]\r\ntype = tcp\r\nlocal_ip = 127.0.0.1\r\nlocal_port = 22\r\nremote_port = 6000\r\n\r\n[web01] \r\ntype = http \r\nlocal_ip = 127.0.0.1 \r\nlocal_port = 80 \r\ncustom_domains = www.wudinaonao.com \r\n\r\n[web02] \r\ntype = https \r\nlocal_ip = 127.0.0.1 \r\nlocal_port = 443 \r\ncustom_domains = www.wudinaonao.com \r\n\r\n"}],"action":{"name":"View Issue","url":"https://github.com/fatedier/frp/issues/904#issuecomment-416503197"}}} [ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/fatedier/frp/issues/904#issuecomment-416503197", "url": "https://github.com/fatedier/frp/issues/904#issuecomment-416503197", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } }, { "@type": "MessageCard", "@context": "http://schema.org/extensions", "hideOriginalBody": "false", "originator": "AF6C5A86-E920-430C-9C59-A73278B5EFEB", "title": "Re: [fatedier/frp] 如何使用frp实现http重定向到https (#904)", "sections": [ { "text": "", "activityTitle": "wudinaonao", "activityImage": "https://assets-cdn.github.com/images/email/message_cards/avatar.png", "activitySubtitle": "@wudinaonao", "facts": [
] } ], "potentialAction": [ { "name": "Add a comment", "@type": "ActionCard", "inputs": [ { "isMultiLine": true, "@type": "TextInput", "id": "IssueComment", "isRequired": false } ], "actions": [ { "name": "Comment", "@type": "HttpPOST", "target": "https://api.github.com", "body": "{\n\"commandName\": \"IssueComment\",\n\"repositoryFullName\": \"fatedier/frp\",\n\"issueId\": 904,\n\"IssueComment\": \"{{IssueComment.value}}\"\n}" } ] }, { "name": "Close issue", "@type": "HttpPOST", "target": "https://api.github.com", "body": "{\n\"commandName\": \"IssueClose\",\n\"repositoryFullName\": \"fatedier/frp\",\n\"issueId\": 904\n}" }, { "targets": [ { "os": "default", "uri": "https://github.com/fatedier/frp/issues/904#issuecomment-416503197" } ], "@type": "OpenUri", "name": "View on GitHub" }, { "name": "Unsubscribe", "@type": "HttpPOST", "target": "https://api.github.com", "body": "{\n\"commandName\": \"MuteNotification\",\n\"threadId\": 372898653\n}" } ], "themeColor": "26292E" } ]
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/fatedier/frp/issues/904#issuecomment-416598495, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AfHHvHT8tqJTuiTF_yqhpU2Z1D_K7vBhks5uVU-YgaJpZM4WOftd.
nginx config for frps (frps running in docker https://hub.docker.com/r/cloverzrg/frps-docker/)
frps.mydomain.com.conf
server {
listen 80;
server_name frp.mydomain.com;
return 302 https://$server_name$request_uri;
}
upstream frp-dashboard {
server 127.0.0.1:7500;
}
upstream frp-http {
server 127.0.0.1:60005;
}
server {
listen 443 ssl http2;
server_name frp.mydomain.com;
ssl_certificate /root/.acme.sh/mydomain.com/fullchain.cer;
ssl_certificate_key /root/.acme.sh/mydomain.com/mydomain.com.key;
gzip_proxied no-cache no-store private expired auth;
gzip_min_length 1000;
location / {
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_http_version 1.1;
proxy_pass http://frp-dashboard/;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
listen 80;
server_name *.frp.mydomain.com;
return 302 https://$host$request_uri;
}
server {
listen 443 ssl http2;
server_name *.frp.mydomain.com;
ssl_certificate /root/.acme.sh/mydomain.com/fullchain.cer;
ssl_certificate_key /root/.acme.sh/mydomain.com/mydomain.com.key;
gzip_proxied no-cache no-store private expired auth;
gzip_min_length 1000;
location / {
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_http_version 1.1;
proxy_pass http://frp-http/;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
ydomain.com.conf
您好,我能问下您上面那个proxy_pass http://frp-http/这个frp-http是修改成什么呢?
ydomain.com.conf
您好,我能问下您上面那个proxy_pass http://frp-http/这个frp-http是修改成什么呢?
比如 127.0.0.1:8080
多谢,找到了😁 2018年9月22日 +0800 PM11:32 朱润根 notifications@github.com,写道:
ydomain.com.conf 您好,我能问下您上面那个proxy_pass http://frp-http/这个frp-http是修改成什么呢? 比如 127.0.0.1:8080 — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.
client 端所有的80请求通过 nginx 转发到 443 ssl,frp 只需要关心内网穿透即可
这issue怎么还不关
感谢,重新检查了一下配置文件,我的也是有一点小问题。已经解决了
我的frp版本号是0.21.0 操作系统是Ubuntu
frps 服务端配置如下: [common] bind_port = 7000 vhost_http_port = 80 vhost_https_port = 443
authentication_timeout = 0
privilege_token = xxx
dashboard_addr = 0.0.0.0 dashboard_port = 7500 dashboard_user = xxx dashboard_pwd = xxx
frpc 客户端配置如下: [common] server_addr = x.x.x.x server_port = 7000
privilege_token = xxxxxx
[ssh] type = tcp local_ip = 127.0.0.1 local_port = 22 remote_port = 6000
[web] type = http local_ip = 127.0.0.1 local_port = 80 custom_domains = www.wudinaonao.com
host_header_rewrite = https://www.wudinaonao.com
[web] type = https local_ip =127.0.0.1 local_port = 443 custom_domains = www.wudinaonao.com
我想实现输入www.wudinaonao.com直接跳转到https协议,web服务器我使用apache2,在apache2里已经做了重定向,在内网可以实现输入IP地址直接跳转到https协议,但是如果在外网输入www.wudinaonao.com的话会返回Not found,如果输入https://www.wudinaonao.com 的话可以访问。 初步判断是因为frp设置的问题,但是我通过设置host_header_rewrite发现并没有效果。请问如何可以实现我的想法。感谢!