我无法为其他服务器configurationapache2前端代理,也提供apache2内容。 我的意图是让apache2提供一些静态内容和一些dynamic应用程序,包括域名和作为文档根目录的子文件夹,还提供一些dynamic的应用程序,包括域名和不带域名的代理。 换句话说,我想要做以下事情
这里是我的(简化)conf文件与我的意图和在意见中出乎意料的行为。
#################################################### # Default settings for http://my.server.edu/ #################################################### Listen 80 ServerName my.server.edu:80 DocumentRoot "/Users/me/Sites" <Directory /> Options FollowSymLinks AllowOverride None Order deny,allow Deny from all </Directory> <Directory "/Users/me/Sites"> Options FollowSymLinks AllowOverride None Order allow,deny Allow from all </Directory> #################################################### # Static content for http://my.server.edu/lib #################################################### Alias /lib "/Users/me/Sites/lib" # The server responds with a "502 Bad gateway" error ScriptAlias /cgi-bin/ "/Users/me/cgi-bin/" <Directory "/Users/me/cgi-bin"> AllowOverride None Options None Order allow,deny Allow from all </Directory> #################################################### # Proxies #################################################### ProxyRequests Off <Proxy *> Order deny,allow Allow from all </Proxy> # The following app should get their static content # from http://my.server.edu/lib, but the server responds # with a "502 Bad gateway" error #################################################### # http://my.server.edu/app1 #################################################### ProxyPass /app1 http://127.0.0.1:5000 ProxyPassReverse /app1 http://127.0.0.1:5000 # The server responds with a "502 Bad gateway" error # when serving static content #################################################### # Virtual host http://vapp1.org #################################################### <VirtualHost *:80> ServerName vapp1.org #################################################### # Static content for http://vapp1.org/lib #################################################### Alias /lib "/Users/me/Sites/lib" ProxyRequests Off <Proxy *> Order deny,allow Allow from all </Proxy> ProxyPass / http://127.0.0.1:5001 ProxyPassReverse / http://127.0.0.1:5001 </VirtualHost> ##################################################### # Virtual host subdomain http://subapp.vapp1.org ##################################################### <VirtualHost *:80> ServerName subapp.vapp1.org #################################################### # Static content for http://subapp.vapp1.org/lib #################################################### Alias /lib "/Users/me/Sites/lib" ProxyRequests Off <Proxy *> Order deny,allow Allow from all </Proxy> ProxyPass / http://127.0.0.1:5002 ProxyPassReverse / http://127.0.0.1:5002 </VirtualHost>
从上面可以看到,如果我的conf文件中有虚拟主机段,服务器会响应一个“502 Bad gateway”错误,该错误应该来自http://my.server.edu 。
但是,如果我删除虚拟主机段,所有其他应用程序工作得很好。
我确定我在以前的机器上工作过,但是现在我无法重现这一点。 我究竟做错了什么?