Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

  ProxyPreserveHost On

  <Location />


<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


  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


share|improve this question
Can you post your whole apache config? I don't see anything moodle related. Also, why are you using mod_proxy? –  Kyle Mar 25 '12 at 23:03
@Kyle the moodle related stuff is at the bottom. The mod_proxy usage is left over from a previous maintainer of the site - but I'm assuming to was the only way he found he cold serve multiple servers on the same IP. –  Jon Hadley Mar 26 '12 at 9:19

1 Answer 1

up vote 3 down vote accepted

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"];

share|improve this answer
Along with a search replace of the database (see docs.moodle.org/22/en/…), this worked a treat, thanks. –  Jon Hadley Apr 24 '12 at 20:14

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.