![Apache ProxyPass 虚拟主机](https://linux22.com/image/611426/Apache%20ProxyPass%20%E8%99%9A%E6%8B%9F%E4%B8%BB%E6%9C%BA.png)
我正在尝试进行与讨论的类似的设置这个旧线程。我已启用 proxy_module、proxy_connect_module、proxy_http_module 和 rewrite_module。它起作用了,但现在当我访问 domain.com 时,它会带我到 ipcamera。我尝试添加另一个虚拟主机,其中 ServerName domain.com 指向 localhost,但这只会使页面挂起。
<VirtualHost *:80>
ServerName ipcam.domain.com
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyErrorOverride On
ProxyPass / http://192.168.1.123/
ProxyPassReverse / http://192.168.1.123/
<Location />
Order allow,deny
Allow from all
</Location>
</VirtualHost>
<VirtualHost *:80>
ServerName domain.com
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyErrorOverride On
ProxyPass / http://localhost/
ProxyPassReverse / http://localhost/
<Location />
Order allow,deny
Allow from all
</Location>
</VirtualHost>
答案1
domain.com 应该托管在同一台服务器上吗?
您正在代理到同一台服务器(localhost 是 localhost),所以您遇到了无限循环?
从第二个虚拟主机中删除代理内容,然后配置 DocumentRoot 等。