我正在尝试配置Apache服务器以使2个子域使用反向代理。我可以将流量重定向到第一个子域(first.example.com),并成功从https站点检索内容。但是,每当我尝试访问第二个子域时,我最终都会从第一个子域中获取内容,并且由于路由与我的本地网站不匹配,所以我找到了一个未找到的页面。Apache反向代理配置 - 子域名
我想知道我可以从当前配置中调整什么,以便我可以从我的本地主机站点获取内容。
这里是我当前的配置:
<Proxy *>
Require all granted
</Proxy>
SSLProxyEngine On
ProxyRequests Off
SSLProxyCheckPeerCN off
SSLProxyCheckPeerExpire off
SSLInsecureRenegotiation on
SSLProxyVerify none
SSLVerifyClient none
SSLProxyCheckPeerName off
<VirtualHost first.example.com:80>
ServerName first.example.com
ProxyPass /first https://stackoverflow.com
ProxyPassReverse /first https://stackoverflow.com
ProxyPassMatch ^/(.*)$ https://stackoverflow.com/$1
</VirtualHost>
<VirtualHost second.example.com:80>
ServerName second.example.com
ProxyPass /site http://localhost/site
ProxyPassReverse /site http://localhost/site
ProxyPassMatch ^/(.*)$ http://localhost/site/$1
</VirtualHost>
非常感谢你提前!
最好的问候!
EdgarMartínez。
你好@Grumpy, 你说得对,我的配置与自身冲突。 这是我如何改变它: '了NameVirtualHost *:80' '<虚拟主机*:80>'' 服务器名first.example.com' '的DocumentRoot “F:/根/ HTMLDOCS”'' 虚拟主机>' '<虚拟主机*:80>'' ProxyPreserveHost on' '服务器名second.example.com' '的ProxyPass “/” “https://stackoverflow.com/”'' ProxyPassReverse“ /“”https://stackoverflow.com/“' ' VirtualHost>' 感谢您花时间回答我的问题。 –