<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>反向代理 on ffff65535</title><link>https://blog.ffff65535.com/tags/%E5%8F%8D%E5%90%91%E4%BB%A3%E7%90%86/</link><description>Recent content in 反向代理 on ffff65535</description><generator>Hugo</generator><language>zh-cn</language><lastBuildDate>Sun, 24 May 2026 07:20:00 +0800</lastBuildDate><atom:link href="https://blog.ffff65535.com/tags/%E5%8F%8D%E5%90%91%E4%BB%A3%E7%90%86/index.xml" rel="self" type="application/rss+xml"/><item><title>自建 GitHub 加速服务：从 CF Workers 迁移到 VPS 部署 hubproxy + Caddy</title><link>https://blog.ffff65535.com/posts/2026/05/24/self-hosted-github-proxy-hubproxy-caddy/</link><pubDate>Sun, 24 May 2026 07:20:00 +0800</pubDate><guid>https://blog.ffff65535.com/posts/2026/05/24/self-hosted-github-proxy-hubproxy-caddy/</guid><description>&lt;p>之前用的 &lt;a href="https://github.com/hunshcn/gh-proxy">gh-proxy&lt;/a>，基于 Cloudflare Workers 搭建。现在换了新域名 &lt;code>1s.gs&lt;/code>，改用 &lt;a href="https://github.com/sky22333/hubproxy">hubproxy&lt;/a> 部署在自己的 VPS 上，完全自托管，不再依赖第三方服务。&lt;/p>
&lt;hr>
&lt;h2 id="架构">架构&lt;/h2>
&lt;pre tabindex="0">&lt;code>用户 → 1s.gs → Caddy (:80/:443) → hubproxy (:5000)
 ↕
 hubproxy_net Docker 网络
&lt;/code>&lt;/pre>&lt;ul>
&lt;li>Caddy 负责 HTTPS 和反代&lt;/li>
&lt;li>hubproxy 不暴露端口，仅通过 Docker 内部网络通信&lt;/li>
&lt;li>旧域名 &lt;code>github-proxy.top&lt;/code> 显示迁移提示页，3 秒后跳转到新域名&lt;/li>
&lt;/ul>
&lt;hr>
&lt;h2 id="步骤">步骤&lt;/h2>
&lt;h3 id="1-部署-hubproxy">1. 部署 hubproxy&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>mkdir -p /opt/services/hubproxy
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;strong>&lt;code>/opt/services/hubproxy/docker-compose.yml&lt;/code>：&lt;/strong>&lt;/p></description></item><item><title>Portainer Edge Agent 连接超时问题解决：自定义 Tunnel URL</title><link>https://blog.ffff65535.com/posts/2025/10/25/fix-portainer-edge-agent-connection-timeout/</link><pubDate>Sat, 25 Oct 2025 03:00:00 +0800</pubDate><guid>https://blog.ffff65535.com/posts/2025/10/25/fix-portainer-edge-agent-connection-timeout/</guid><description>&lt;p>当你将 &lt;strong>Portainer Server&lt;/strong> 部署在 &lt;strong>反向代理（如 Caddy、Nginx 或 Traefik）之后&lt;/strong>，并尝试添加 &lt;strong>Edge Agent&lt;/strong> 时，可能会遇到如下错误：&lt;/p>
&lt;pre tabindex="0">&lt;code class="language-log" data-lang="log">2025/10/25 16:59:33 client: Connecting to ws://portainer.yourdomain.com:8000
2025/10/25 17:00:18 client: Connection error: dial tcp [your ip]:8000: i/o timeout
2025/10/25 17:00:18 client: Give up
&lt;/code>&lt;/pre>&lt;p>该问题的根本原因在于：&lt;strong>Portainer 默认生成的 Edge 连接信息中，Tunnel 地址为 &lt;code>域名:8000&lt;/code>，但反向代理通常并未暴露 8000 端口&lt;/strong>，导致 Edge Agent 无法建立 WebSocket 隧道连接。&lt;/p></description></item><item><title>ghost+nginx无限重定向</title><link>https://blog.ffff65535.com/posts/2022/03/14/ghost-nginx-unlimited-redirection/</link><pubDate>Mon, 14 Mar 2022 16:51:58 +0800</pubDate><guid>https://blog.ffff65535.com/posts/2022/03/14/ghost-nginx-unlimited-redirection/</guid><description>&lt;p>修改ngixn配置&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-text" data-lang="text">&lt;span style="display:flex;">&lt;span>server
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>{
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> listen 80;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>		listen 443 ssl http2;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> server_name ghost.你的域名.com;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> index index.php index.html index.htm default.php default.htm default.html;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> root /www/wwwroot/ghost.你的域名.com;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> #SSL-START SSL相关配置，请勿删除或修改下一行带注释的404规则
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> #error_page 404/404.html;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> #HTTP_TO_HTTPS_START
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> if ($server_port !~ 443){
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> rewrite ^(/.*)$ https://$host$1 permanent;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> #HTTP_TO_HTTPS_END
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> ssl_certificate /www/server/panel/vhost/cert/ghost.你的域名.com/fullchain.pem;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> ssl_certificate_key /www/server/panel/vhost/cert/ghost.你的域名.com/privkey.pem;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> ssl_ciphers EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> ssl_prefer_server_ciphers on;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> ssl_session_cache shared:SSL:10m;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> ssl_session_timeout 10m;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> add_header Strict-Transport-Security &amp;#34;max-age=31536000&amp;#34;;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> error_page 497 https://$host$request_uri;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> #SSL-END
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> #ERROR-PAGE-START 错误页配置，可以注释、删除或修改
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> #error_page 404 /404.html;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> #error_page 502 /502.html;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> #ERROR-PAGE-END
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> #PHP-INFO-START PHP引用配置，可以注释或修改
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>		include enable-php-00.conf;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> #PHP-INFO-END
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> # 拦截请求，直接返回上传的静态图片资源，缓存时间 1 个月
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> location ^~ /content/images {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> alias /www/ghost_site/content/images;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> expires 1M;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> access_log off;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> add_header Cache-Control &amp;#34;public&amp;#34;;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> location ~ ^/(image|javascript|js|css|media|static)/ {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> proxy_pass http://127.0.0.1:2368;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> # root /www/ghost.qinan.co/web/static/;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> access_log off;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> expires 30d;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> # 不缓存 ghost 核心文件（反向代理后台管理）
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> location ^~ /ghost/ {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> proxy_set_header X-Real-IP $remote_addr;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> proxy_set_header X-Forwarded-Proto $scheme;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> proxy_set_header Host $http_host;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> proxy_pass http://127.0.0.1:2368;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> # favicon
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> location = /favicon.ico {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> root /www/ghost_site/core/shared;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> access_log off;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> log_not_found off;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> expires 30d;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> # cache urls
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> # 反向代理博客请求到服务端
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> location / {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> proxy_cache_valid 200 60m;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> proxy_cache_bypass $http_cache_control;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> proxy_redirect off;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> add_header X-Proxy-Cache $upstream_cache_status;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> proxy_ignore_headers X-Accel-Expires Expires Cache-Control;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> # 后端的Web服务器可以通过X-Forwarded-For获取用户真实IP
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> proxy_set_header Host $host;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> proxy_set_header X-Real-IP $remote_addr;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> proxy_set_header X-Forwarded-Proto https;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> proxy_set_header X-Forwarded-Host $host;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> proxy_pass http://127.0.0.1:2368;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> proxy_max_temp_file_size 0;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> proxy_connect_timeout 90;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> proxy_send_timeout 90;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> proxy_read_timeout 90;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> proxy_buffering off;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> proxy_temp_file_write_size 64k;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> location ~ /\.
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> deny all;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> #REWRITE-START URL重写规则引用,修改后将导致面板设置的伪静态规则失效
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> include /www/server/panel/vhost/rewrite/ghost.你的域名.com.conf;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> #REWRITE-END
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> #禁止访问的文件或目录
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> return 404;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> #一键申请SSL证书验证目录相关设置
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> location ~ \.well-known{
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> allow all;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> 
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> expires 30d;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> error_log /dev/null;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> access_log /dev/null;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> location ~ .*\.(js|css)?$
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> {
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> expires 12h;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> error_log /dev/null;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> access_log /dev/null;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> }
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>		access_log /www/wwwlogs/ghost.你的域名.com.log;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> error_log /www/wwwlogs/ghost.你的域名.com.error.log;
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>}
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>参考资料：&lt;/p></description></item></channel></rss>