首页 > 解决方案 > Apache2 反向代理的问题

问题描述

我需要在 apache2 中为 icecast 服务器创建一个反向代理,但使用另一个虚拟主机作为一个简单的网站

我设法在 apache Virtualhost 中使用此配置创建了反向代理

<VirtualHost 100.100.100.100:80>
    ServerName icecast.xxx.com
    ProxyPass / http://localhost:8000/
</VirtualHost>

100.100.100.100 是服务器的 IP,而 xxx.com 是域所以当我在浏览器icecast.xxx.com中键入时,icecast 管理面板(在 8000 端口上)会出现

然后我添加了另一个虚拟主机

<VirtualHost *:80>
        ServerName xxx.com
        ServerAlias www.xxx.com
        ServerAdmin MY_EMAIL
        DocumentRoot /var/www/site/html

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

我已经启用了他sudo a2ensite NAME_OF_THE_CONFIG_FILE

但是当我去 VPS 的 ip 或去xxx.com/ www.xxx.comicecast2 管理面板出现!

我不知道如何解决这个问题,我可能认为错误在行

标签: networkingapache2reverse-proxyvirtualhost

解决方案


我终于设法解决了这个问题,只是在反向代理虚拟主机中,而不是<VirtualHost 100.100.100.100:80> 我需要把 <VirtualHost *:80>


推荐阅读