我正在尝试将apacheconfiguration为充当某些子域的代理。 我几乎已经configuration好了,但是有一个问题。
有了这个configuration,我设法得到www.mywebsite.com正常服务(没有代理/默认的apacheconfiguration),而subdomain.mywebsite.com服务通过代理到localhost端口8080.我遇到的问题是,请求到index.html以外的文件获取代理错误502。
ServerAdmin [email protected] ServerName subdomain.mywebsite.com DocumentRoot "/opt/www/subdomain" <Proxy *> Order allow,deny Allow from all </Proxy> ProxyPass / http://127.0.0.1:8080 ProxyPassReverse / http://127.0.0.1:8080
我怎样才能configurationApache通过代理提供所有文件?
我不太清楚你发布的内容如何做你想要的。 但是我对这个问题的理解可能是错误的。 我明白你想拥有:
所以你只需要这个:
<VirtualHost *:80> DocumentRoot "/opt/www/subdomain" ServerName www.mywebsite.com </VirtualHost> <VirtualHost *:80> ServerName subdomain.mywebsite.com ProxyPass / http://localhost:8080/ ProxyPassReverse / http://localhost:8080 </VirtualHost>
ProxyPass的一个区别在于你所拥有的是我有一个尾部的斜线来匹配指令的右侧。