Moodle 仅在 IP 上提供服务 - 不适用于 mod_proxy

Jon*_*ley 1 moodle mod-proxy apache-2.2

我正在尝试在 Ubuntu 机器上设置一个 Moodle 服务器,该机器已经通过 Apache 为 Plone & Trac 提供服务。

在我的 Moodle 配置中,我有 $CFG->wwwroot = ' http://www.server-name.org/moodle '

下面的(复杂但有效的)配置适用于前两个,但是当我访问 www.server-name.com/moodle 时,我得到:

检测到访问错误,此服务器只能通过“ http://xxx.xxx.xxx.xxx:8888/moodle ”地址访问,抱歉

然后它转发到 IP 地址,在那里 Moodle 可以正常工作。

我缺少什么才能使服务器名称方法正常工作?


Apache 配置如下:

LoadModule transform_module /usr/lib/apache2/modules/mod_transform.so
Listen 8080
Listen 8888

Include /etc/phpmyadmin/apache.conf

<VirtualHost xxx.xxx.xxx.xxx:8080>

  <Proxy *>
    Order deny,allow
    Allow from all
  </Proxy>

  ProxyPreserveHost On

  <Location />
    ProxyPass http://127.0.0.1:8082/
    ProxyPassReverse http://127.0.0.1:8082/
  </Location>

</VirtualHost>

<VirtualHost xxx.xxx.xxx.xxx:80>
  ServerName  www.server-name.org
  ServerAlias server-name.org

  ProxyRequests Off

  FilterDeclare MyStyle RESOURCE
  FilterProvider MyStyle XSLT resp=Content-Type $text/html
  TransformOptions +ApacheFS +HTML
  TransformCache /theme.xsl /home/web/webapps/plone/theme.xsl
  TransformSet /theme.xsl
  FilterChain MyStyle

  ProxyPass /issue-tracker !
  ProxyPass /moodle !  

  <Location /issue-tracker/login>

    AuthType Basic
    AuthName "Trac"
    AuthUserFile /home/web/webapps/plone/parts/trac/trac.htpasswd
    Require valid-user

  </Location>


  Alias /moodle /usr/share/moodle/

  <Directory /usr/share/moodle/>

    Options +FollowSymLinks
    AllowOverride None

    order allow,deny
    allow from all

    <IfModule mod_dir.c>
      DirectoryIndex index.php
    </IfModule>

  </Directory>

  </VirtualHost>
Run Code Online (Sandbox Code Playgroud)

Saš*_*ašo 5

问题在于 Moodle 配置,因为它$CFG->wwwroot根本不应该受到服务器的影响。

也许如果您使用第三方安装脚本,该变量会再次设置和/或在不同的文件中。尝试http://xxx.xxx.xxx.xxx:8888/moodle在moodle目录中进行grep搜索。

作为解决方法,您可以尝试使用 $CFG->wwwroot = 'http://'.$_SERVER["HTTP_HOST"];