elu*_*192 5 proxy reverse moodle
我在 apache 代理后面设置 Moodle 实例时遇到问题。
这是我的 apache 前端,它代理正在运行的服务器。
<VirtualHost *:80>
ServerName public.domain.com
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / http://10.10.10.10:81/moodle/
ProxyPassReverse / http://10.10.10.10:81/moodle/
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
和。
$CFG->wwwroot = 'http://public.domain.com';
Run Code Online (Sandbox Code Playgroud)
我安装没有问题,但是安装完成后我在浏览器中尝试:
此重定向到:http://public.domain.com/moodle/index.php? sessionstarted=1&lang=en ...
有谁知道会发生什么?
最后我已经能够解决这个问题,我正在更详细地写这个答案,以便其他遇到这个问题的人可以遵循我的答案。
首先,我们需要编辑站点的 apache2 配置:一般来说,您指定站点的 apache2 配置可以在 中找到/etc/apache2/sites-enabled。根据您使用的是 http 还是 https,您需要编辑正确的配置文件。http 的默认名称是000-default.confhttps 的默认名称是000-default-ssl.conf
在各部分之间添加以下行<VirtualHost *:80>....</VirtualHost>。
# MOODLE
ProxyRequests Off
ProxyPreserveHost On
ProxyPass "/" "http://10.10.10.10:81/moodle/"
ProxyPassReverse "/" "http://10.10.10.10:81/moodle/"
Run Code Online (Sandbox Code Playgroud)
然后我们需要重新启动 apache2 网络服务器,这可以通过命令来完成service apache2 restart。
现在我们还需要编辑moodle 文件中的一些内容config.php。如果您使用 Moodle 指南中的默认安装位置,则可以在/var/www/html/moodle具有 IP(在本例中)的服务器上找到此文件。10.10.10.10
在config.php文件中,我们在默认声明下附加以下行$CFG: 请确保根据您的服务器设置更改所有值。
$CFG->wwwroot = 'http://public.domain.com';
$CFG->dirroot = '/var/www/html/moodle';
$CFG->reverseproxy = true;
//$CFG->sslproxy = true; //UNCOMMENT this line if you are using SSL
Run Code Online (Sandbox Code Playgroud)
注意:如果您没有在公共网络服务器上使用根目录,请确保您没有使用与moodle 在子服务器上使用的目录相同的目录。例如,http://public.domain.com/moodle如果在子服务器上安装moodle,则会失败,/var/html/moodle因为两个目录相同并且代理由于某种原因循环。我对这个问题的简单解决方法是只需将 Moodle 安装移动到/var/html/moodley包含config.php. 这解决了我遇到的每个问题。
| 归档时间: |
|
| 查看次数: |
9520 次 |
| 最近记录: |