Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Regex 来自子域的apache proxypass_Regex_Apache_Mod Proxy_Proxypass - Fatal编程技术网

Regex 来自子域的apache proxypass

Regex 来自子域的apache proxypass,regex,apache,mod-proxy,proxypass,Regex,Apache,Mod Proxy,Proxypass,我想在apache2中从子域代理传递到像这样的其他端口 -> 是否仍要使用此子域而不是所有子域编写配置文件 不管怎样,比如http://.*.example.com->http://.*.example.com:6543 http://.*.example.com/first/second->http://.*.example.com:6543/first/second 这是我的配置文件 ServerName example.com ProxyPassMatch^([^.]+)\.exampl

我想在apache2中从子域代理传递到像这样的其他端口

->

是否仍要使用此子域而不是所有子域编写配置文件

不管怎样,比如http://.*.example.com->http://.*.example.com:6543

http://.*.example.com/first/second->http://.*.example.com:6543/first/second

这是我的配置文件


ServerName example.com
ProxyPassMatch^([^.]+)\.example\.com(.*)http://$1.example.com:6543/$2
ProxyPassReverse/http://example.com
你需要这个。它可以使用
[P]
进行代理。按如下方式使用它(为了满足语法突出显示,VirtualHost标记被删除):

%1
是在条件中匹配的子域,
$1
是由规则匹配的路径


您也可以在不使用重写条件的情况下使用

RewriteRule ^(.*) http://%{HTTP_HOST}:6543/$1 [P]
我使用了上面的额外步骤来增加信息量,例如,在您想要的活动中

ServerName example.com
RewriteEngine on
RewriteCond %{HTTP_HOST} ^([^.]+)\.example\.com$
RewriteRule ^(.*) http://%1.example.com:6543/$1 [P]
RewriteRule ^(.*) http://%{HTTP_HOST}:6543/$1 [P]