I'm trying to set a moodle server up on an Ubuntu box, which already serves Plone & Trac via Apache.
In my Moodle config I have $CFG->wwwroot = 'http://www.server-name.org/moodle'
The (convoluted, but working) configuration below works fine for the first two, but when I visit www.server-name.com/moodle I get:
Incorrect access detected, this server may be accessed only through "http://xxx.xxx.xxx.xxx:8888/moodle" address, sorry
It then forwards to the IP address, where Moodle functions fine.
What am I missing to get the server name approach working correctly?
Apache Config follows:
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>
The problem lies in Moodle configuration, as the
$CFG->wwwroot
shouldn't be affected by the server at all.Perhaps if you used a third party installation script, that variable was set again and/or in a different file. Try doing a grep search for
http://xxx.xxx.xxx.xxx:8888/moodle
in the moodle directories.As a workaround, you could try using
$CFG->wwwroot = 'http://'.$_SERVER["HTTP_HOST"];