ubuntu apache2 mod_proxy 替换内部 url

标签 ubuntu apache2 mod-proxy

我已经按照我在 Google 上找到的所有指南进行操作,但仍然无法解决这个问题!

我已经设法设置 mod_proxy 来拉回一个内部网站,但是该网站添加了指向菜单项的内部链接,这对外部用户不起作用,所以我试图从 .int 重写它们域到 .com 域。

我有以下虚拟主机。

<VirtualHost *:80>
    ServerName shop.itmanx.com

    ProxyRequests Off
    ProxyPreserveHost On
    #ProxyHTMLInterp On     #used to be ProxyHTMLEnable
    #ProxyHTMLExtended On   #will parse all scripts and css files as well [slow if on]

    ProxyPass / http://shop.itmanx.int/
    ProxyPassReverse / http://shop.itmanx.int/
    #ProxyHTMLURLMap / /test/
    ProxyHTMLURLMap (.*)itmanx.int(.*) $1itmanx.com$2 [Rin]

    <Location />
        Order allow,deny
        Allow from all
    </Location>
</VirtualHost>

我已确保组件已加载

[Sun Jan 29 14:59:46 2012] [warn] module proxy_module is already loaded, skipping
[Sun Jan 29 14:59:46 2012] [warn] module proxy_http_module is already loaded, skipping
[Sun Jan 29 14:59:46 2012] [warn] module proxy_html_module is already loaded, skipping

但没有链接被更改。那我错过了什么?

服务器是Ubuntu Server 11.10

最佳答案

万岁!!!感谢 Hudson 的人谁引用了以下内容:

Because hudson already compress its output, you can not use the normal proxy-html filter to modify urls:`

SetOutputFilter proxy-html

Instead you can use the following:

SetOutputFilter INFLATE;proxy-html;DEFLATE;

因为这一行,它现在可以工作了

<VirtualHost *:80>
    ServerName shop.itmanx.com
    SetEnv proxy-nokeepalive 1

    ProxyPass / http://shop.itmanx.int/
    ProxyPassReverse / http://shop.itmanx.int/
    ProxyRequests Off

    SetOutputFilter INFLATE;proxy-html;DEFLATE;
    ProxyHTMLURLMap (.*)itmanx.int(.*) $1itmanx.com$2 [R]
</VirtualHost>

关于ubuntu apache2 mod_proxy 替换内部 url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9054192/

相关文章:

linux - apache 使用 POST 数据代理 HTTPS 到 HTTP

ruby-on-rails - nginx 比 Apache2 减少了多少内存占用?

php - Apache 被本地主机 (127.0.0.1) 击中

apache - mod_proxy/proxypass 错误

ubuntu - 通过 Ansible 使用选项 --disabled-password 创建用户

linux - 在 Linux Mint 14 Nadia 上使用 Apache2 配置 Request Tracker 4.0

apache - 如何使用 Apache mod_proxy 隐藏 url 的端口号?

linux - 命令行连接到无线网络在 ubuntu 10.04 上不起作用

bash - 使用 Bash 删除除某些文件和目录之外的所有文件和目录

linux - 如果我有带有独立显卡的 AMD 混合配置,如何配置在 (k)ubuntu 中使用哪个 HDMI 端口