【问题标题】:apache 2.4 proxy all but not some wordsapache 2.4 proxy all but not some words
【发布时间】:2017-02-09 18:02:25
【问题描述】:

我有一个虚拟主机配置,我想创建 2 个代理,第一个代理通道必须将所有调用重定向到 http://localhost:3333,但我想排除 myhost.localhot/myforlder。 myfolder 是“别名”

我的主机.localhost

<VirtualHost *:80>        
    ServerAdmin myhost.localhost
    ServerName  myhost.localhost
    ServerAlias www.myhost.localhost

    DocumentRoot C:/wamp/www/myhost/

    DirectoryIndex index.php index.html index.htm
    RewriteEngine On

    #this a alias for get correct file index.html
    #work fine only if i remove next proxyPass
    Alias "/myfolder " "C:/wamp/www/myfolder/theme" 

    #all calls proxy
    ProxyPass / http://localhost:3333/

    <Directory />
        Options FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all              
    </Directory>

    # Ricordarsi di creare la directory
    ErrorLog  C:/wamp/logs/myhost.localhost.error.log
    CustomLog C:/wamp/logs/myhost.localhost.access.log combined

</VirtualHost>  

如果我调用 http://myhost.localhost/examples 工作,则使用此配置,但如果我调用 myhost.localhot/myforlder,则调用在端口为 3333 的服务器中。

如何从 proxyPass 指令中排除 myfolder?

【问题讨论】:

    标签: apache proxypass


    【解决方案1】:

    您可以在 apache 中从 mod_proxy 中排除路径,在末尾添加感叹号 (!)。

    ProxyPass /my/excluded/path !
    

    此行必须在之前添加:

    #all calls proxy
    ProxyPass / http://localhost:3333/
    

    【讨论】:

    • 别名 "/myfolder" "C:/wamp/www/myfolder/theme" ProxyPass / localhost:3333 ProxyPass /myfolder !尝试过,但不适用于“myfolder”
    • 工作如果第一行是 ProxyPass /myfolder ! ,对不起@bogdan-stoica
    猜你喜欢
    • 2020-09-30
    • 1970-01-01
    • 2015-03-27
    • 2016-04-08
    • 1970-01-01
    • 1970-01-01
    • 2022-12-02
    • 2019-08-02
    • 1970-01-01
    相关资源
    最近更新 更多