V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
NGINX
NGINX Trac
3rd Party Modules
Security Advisories
CHANGES
OpenResty
ngx_lua
Tengine
在线学习资源
NGINX 开发从入门到精通
NGINX Modules
ngx_echo
jsjcjsjc
V2EX  ›  NGINX

为啥这个网站使用宝塔只能反代首页?点其他的就回复到原站

  •  1
     
  •   jsjcjsjc · 2022-09-25 08:12:18 +08:00 · 2476 次点击
    这是一个创建于 550 天前的主题,其中的信息可能已经有所发展或是发生改变。

    我的配置是这样的,但是只能反代首页,点击其他链接就会恢复网址哈~

    同时测试了几个其他网址,没问题哈

    感谢

    11 条回复    2022-09-26 19:45:20 +08:00
    jsjcjsjc
        1
    jsjcjsjc  
    OP
       2022-09-25 08:55:39 +08:00
    就这个网址 www.websiteplanet.com
    zggsong
        2
    zggsong  
       2022-09-25 09:26:09 +08:00
    去研究一下这个 https://reflare.js.org/
    o00o
        3
    o00o  
       2022-09-25 09:45:51 +08:00
    求盗于路?
    xilou31
        4
    xilou31  
       2022-09-25 11:16:04 +08:00
    没用过宝塔,但是你这个像是只反代了 url ,没有反代网址后的 uri
    placeholder
        5
    placeholder  
       2022-09-25 13:16:34 +08:00
    不是,网页里用 a 标签写死的 href 也能反代吗?
    lcy630409
        6
    lcy630409  
       2022-09-25 14:02:48 +08:00
    点那个高级功能,“代理目录”填 /
    jsjcjsjc
        7
    jsjcjsjc  
    OP
       2022-09-25 17:23:19 +08:00
    @lcy630409 感谢恢复
    好像也不行哈~~
    treblex
        8
    treblex  
       2022-09-25 19:11:04 +08:00
    因为他 a 标签都是写的完整路径,包含了域名的
    用 php curl 之后替换部分内容输出似乎是可以的
    jsjcjsjc
        9
    jsjcjsjc  
    OP
       2022-09-25 19:32:19 +08:00
    @treblex nginx 无解吗?
    Ch3n4y
        10
    Ch3n4y  
       2022-09-25 21:09:53 +08:00
    发送域名改为$host 试试
    jsjcjsjc
        11
    jsjcjsjc  
    OP
       2022-09-26 19:45:20 +08:00
    搞定
    ```
    location / {
    proxy_ssl_name www.websiteplanet.com;
    proxy_ssl_server_name on;
    gzip on;
    gzip_min_length 1k;
    gzip_buffers 4 16k;
    gzip_comp_level 5;
    gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
    gzip_vary off;
    proxy_redirect off;
    proxy_set_header Host www.websiteplanet.com;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_pass https://www.websiteplanet.com;
    proxy_set_header Accept-Encoding "";
    sub_filter 'websiteplanet.com' 'websiteplanet.org';
    sub_filter_types text/xml;
    sub_filter_once off;
    }
    ```
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3258 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 11:53 · PVG 19:53 · LAX 04:53 · JFK 07:53
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.