apache - Moodle Apache 代理

标签 apache proxy reverse moodle

我在 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>

问题是,我不断发现 Moodle 只能从 182.168.1.101 访问,这与预期不太相符。我已经能够配置 Confluence 和其他平台,但 Moodle 不起作用。

具体错误如下。

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

有人知道会发生什么吗?

最佳答案

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

你可以试试

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

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

关于apache - Moodle Apache 代理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25879299/

相关文章:

python - list.reverse() 不工作

c# - 反转字符串

php - apache2 不在 Debian Stretch 上执行 php 脚本

objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts

proxy - 如何在tweepy中设置socks5代理?

list - 使用 foldl 和 foldr 反转 Scheme 中的列表

apache 到 tomcat : mod_jk vs mod_proxy

regex - htaccess : alternative to using <if>?

apache - 使用 apache mod proxy 删除基本身份验证 header

proxy - 在终端中使用 SOCKS 传输广播