在 Apache 中设置反向代理的问题
我和我的室友都有一个单独的网络服务器,我们正在尝试设置。 我们正在尝试使用 mod_proxy,以便他的服务器根据服务器名称将请求转发到我的机器(我们在一台路由器后面有两台单独的机器)。 我已经给出了当前 apache 配置中的基础知识,但在尝试访问第二个域(第一个 www 域工作正常)时,我们收到 403 Forbidden 错误。
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /var/www
ServerName www.<domain1>.com
</VirtualHost>
<VirtualHost *:80>
ProxyPreserveHost On
ProxyPass / http://<IP addr of other box>:80
ProxyPassReverse / http://<IP addr of other box>:80
ServerName <dummydomain>.gotdns.com
</VirtualHost>
My roommate and I each have a separate webserver we are trying to set up. We are trying to use mod_proxy so that his server will forward requests to my machine (we have two seperate machines behind one router) based on the server name. I've given the basics of what we have in our apache config currently but we are getting a 403 Forbidden error when trying to access the second domain (the first, www domain, works fine).
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /var/www
ServerName www.<domain1>.com
</VirtualHost>
<VirtualHost *:80>
ProxyPreserveHost On
ProxyPass / http://<IP addr of other box>:80
ProxyPassReverse / http://<IP addr of other box>:80
ServerName <dummydomain>.gotdns.com
</VirtualHost>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的 mods-enabled/proxy.conf 可能会阻止任何代理请求(默认情况下拒绝所有请求)。 它应该包括以下内容:
编辑:还要确保 mod_proxy 子模块符号链接到 mods-enabled (在这种情况下,http 子模块是 mods-available/proxy_http.load)
Your mods-enabled/proxy.conf might be blocking any proxy requests (it's deny all by default). It should include the following instead:
EDIT: Also make sure that the mod_proxy submodules are sym linked into mods-enabled (in this case, the http sub module which is mods-available/proxy_http.load)
只需输入两条路线:
这对我有用
Just put both routes:
This worked form me