Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 = ''

The (convoluted, but working) configuration below works fine for the first two, but when I visit I get:

Incorrect access detected, this server may be accessed only through "" 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/
Listen 8080
Listen 8888

Include /etc/phpmyadmin/apache.conf


  <Proxy *>
    Order deny,allow
    Allow from all

  ProxyPreserveHost On

  <Location />



  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
up vote 4 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 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…), 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.