title: Moodle apache proxy
body: <p>I'm having troubles setting up a moodle instance behind an apache proxy.</p>
  
  <p>Here's my apache front-end that proxies to the running server.</p>
  
  <pre><code>NameVirtualHost www.example.com:443
  &lt;VirtualHost www.example.com:443&gt;
    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
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>On the concrete server I've got.</p>
  
  <pre><code> $CFG-&gt;wwwroot = 'http://192.168.1.101/classes';
  </code></pre>
  
  <p>And</p>
  
  <pre><code>&lt;VirtualHost 192.168.1.101:80&gt;
      ServerAlias 192.168.1.101
      ServerAdmin webmaster@localhost
      ServerName 192.168.1.101
      DocumentRoot /var/www/
      &lt;Directory /&gt;
              Options FollowSymLinks
              AllowOverride None
      &lt;/Directory&gt;
      &lt;Directory /var/www/&gt;
              Options Indexes FollowSymLinks MultiViews
              AllowOverride None
              Order allow,deny
              allow from all
      &lt;/Directory&gt;
  
      ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
      &lt;Directory "/usr/lib/cgi-bin"&gt;
              AllowOverride None
              Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
              Order allow,deny
              Allow from all
      &lt;/Directory&gt;
  
      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/"
      &lt;Directory "/usr/share/doc/"&gt;
              Options Indexes MultiViews FollowSymLinks
              AllowOverride None
              Order deny,allow
              Deny from all
              Allow from 127.0.0.0/255.0.0.0 ::1/128
      &lt;/Directory&gt;
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>The thing is that I keep getting that moodle is only accessible from 182.168.1.101 something is not quite matching the expected. I've been able to configure confluence and other platforms but moodle doesn't work.</p>
  
  <p>The concrete error is as follows.</p>
  
  <pre><code>Incorrect access detected, this server may be accessed only through "http://192.168.1.101/classes"       address, sorry. Please notify server administrator.
  </code></pre>
  
  <p>Does anyone know what might be happening?</p>