The error message "Reverse proxy enabled so the server cannot be accessed directly. Please contact the server administrator." in Moodle is typically associated with a server configuration that utilizes a reverse proxy. This error arises when the Moodle server detects direct access to it without going through the configured reverse proxy.
$CFG->wwwroot = 'https://moodle.example.com';
server {
listen 80;
server_name moodle.example.com;
location / {
proxy_pass http://localhost:8080; # Moodle running on port 8080
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
$CFG->reverseproxy = true;
$CFG->sslproxy = true; // If using SSL on the reverse proxy
Check the config.php file: Ensure the wwwroot value is correct and matches the reverse proxy URL.Review the reverse proxy configuration (Nginx or Apache): Make sure the proxy header settings are accurate.Add trusted proxy to Moodle configuration: Specifically, set $CFG->reverseproxy = true.Investigate server logs (Moodle or web server): Search for detailed error messages that might indicate other configuration issues.
0 comments:
Post a Comment