【问题标题】:Moodle apache proxyMoodle Apache 代理
【发布时间】:2014-09-16 22:18:40
【问题描述】:

我在 apache 代理后面设置 moodle 实例时遇到问题。

这是我的 apache 前端,它代理到正在运行的服务器。

NameVirtualHost www.example.com:443
<VirtualHost www.example.com:443>
  ProxyPreserveHost On
  ProxyRequests Off
  ServerName www.example.com
  ServerAlias www.example.com
  ProxyPass / http://192.168.1.101/
  ProxyPassReverse / http://192.168.1.101/
  SSLEngine on
  SSLCertificateFile /etc/ssl/crt/example.com.crt
  SSLCertificateKeyFile /etc/ssl/crt/example.com.key
  SSLCACertificatePath /etc/ssl/crt
  SSLCertificateChainFile /etc/ssl/crt/example.com.bundle.crt
</VirtualHost>

在我拥有的具体服务器上。

 $CFG->wwwroot = 'http://192.168.1.101/classes';

<VirtualHost 192.168.1.101:80>
    ServerAlias 192.168.1.101
    ServerAdmin webmaster@localhost
    ServerName 192.168.1.101
    DocumentRoot /var/www/
    <Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
    <Directory /var/www/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
            AllowOverride None
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            Order allow,deny
            Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
            Options Indexes MultiViews FollowSymLinks
            AllowOverride None
            Order deny,allow
            Deny from all
            Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>
</VirtualHost>

问题是我一直认为只能从 182.168.1.101 访问 moodle,这与预期的不太匹配。我已经能够配置 confluence 和其他平台,但 moodle 不起作用。

具体错误如下。

Incorrect access detected, this server may be accessed only through "http://192.168.1.101/classes"       address, sorry. Please notify server administrator.

有人知道会发生什么吗?

【问题讨论】:

    标签: apache proxy reverse moodle


    【解决方案1】:

    这是一个 Moodle 错误消息,config.php 中的 wwwroot 必须匹配。

    你可以试试

    $CFG->wwwroot   = 'http://' . $_SERVER['HTTP_HOST'];
    

    虽然这可能不允许 Moodle 中的某些命令行更新。

    【讨论】:

    • 哼,不,我想。 Apache 从 https 出发并使用 http 发出请求。现在的主要问题是我无法测试它,因为我已经有了解决方法,而且由于它是生产环境,我不会再试一次,除非我真的需要。不过感谢您的努力:)
    【解决方案2】:

    在代理服务器上,修改VirtualHost条目如下:

    ProxyPass / http://192.168.1.101/classes
    ProxyPassReverse / http://192.168.1.101/classes
    

    对于 Moodle,您在 Moodle 的 config.php 中为

    设置的内容

    $CFG-&gt;wwwroot

    ...必须与代理服务器上 VirtualHost 定义中的 ProxyPassProxyPassReverse 值匹配。

    【讨论】:

      【解决方案3】:

      那么,指向前端的 URL 是什么?

      这就是您需要将 $CFG->wwwroot 设置为的内容。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2017-06-30
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多