Apache2 将 /example 指向另一个本地 ip 网络服务器

Apache2 将 /example 指向另一个本地 ip 网络服务器

我有一个在 192.168.1.2 上运行的 apache2 服务器,可以使用 publicip/ 从外部访问。

我想要做的是将 publicip/example1 重定向到另一个本地 ip(比如说 192.168.1.3),并将 publicip/example2 重定向到另一个 ip(192.168.1.4),...

我尝试按照此处的说明进行操作:https://stackoverflow.com/questions/21441227/apache-using-reverse-proxy-and-run-local-website

因此我创建了一个如下所示的 site.conf:

<VirtualHost *:80>

    ServerName mysite.com
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html/mysite.com

    <Directory /var/www/html/mysite.com>
            require all granted
            AllowOverride All
    </Directory>

    <Location /example1 >
            ProxyPass http://192.168.1.3:80/
            ProxyPassReverse http://192.168.1.3:80/
    </Location>

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

</VirtualHost>

使用此配置,我可以以 root 身份访问 mysite.com,但是当我尝试连接 mysite.com/example1 时,它不起作用并出现此错误:

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at webmaster@localhost to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

Apache 错误日志显示:

[Tue Feb 14 15:46:00.894989 2017] [proxy:warn] [pid 1993] [client XX.XX.XX.XX:51795] AH01144: No protocol handler was valid for the URL /example1. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule.
[Tue Feb 14 15:46:06.938982 2017] [proxy:warn] [pid 1995] [client XX.XX.XX.XX:51804] AH01144: No protocol handler was valid for the URL /example1. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule.

请问我做错了什么?

谢谢!

相关内容