Hi
I am trying to set up a moodle behind NGINX reverse-proxy and I cannot get it working right. Below are my config files. Basically site formatting is gone and I cannot logon to the app. Cannot see anything helpful in the logs and web servers conf seems to be fine as is serving files (ex css, upgrade.txt)
I would appreciate any hint where to look for the source of the issue.
*****************
NGINX Vhost conf - proxy
*****************
server {
listen 80;
server_name moodle.example.eu;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
server_name moodle.example.eu;
ssl_certificate /etc/letsencrypt/live/example.eu/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.eu/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5:!kEDH;
ssl_prefer_server_ciphers on;
#charset koi8-r;
access_log /var/log/nginx/moodle.access.log main;
error_log /var/log/nginx/moodle.error.log;
include /etc/nginx/default.d/*.conf;
location / {
add_header Front-End-Https on;
# Send traffic to the backend
proxy_pass http://192.168.1.46/;
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 $remote_addr;
proxy_set_header X-Forwarded-Protocol $scheme;
proxy_redirect off;
}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
***************************
httpd conf on the host with app
***************************
<VirtualHost *:80>
ServerAdmin admin@moodle
DocumentRoot /var/www/html/moodle/
ServerName moodle.example.eu
<Directory /var/www/html/moodle/>
Options FollowSymLinks
AllowOverride None
Order allow,deny
allow from all
</Directory>
LogLevel info
ErrorLog /var/log/httpd/moodle.error_log
CustomLog /var/log/httpd/moodle.access_log common
</VirtualHost>
****************
moodle config.php
****************
?php // Moodle configuration file
unset($CFG);
global $CFG;
$CFG = new stdClass();
$CFG->dbtype = 'mariadb';
$CFG->dblibrary = 'native';
$CFG->dbhost = 'localhost';
$CFG->dbname = 'moodle';
$CFG->dbuser = 'moodleuser';
$CFG->dbpass = 'password';
$CFG->prefix = 'mdl_';
$CFG->dboptions = array (
'dbpersist' => 0,
'dbport' => '',
'dbsocket' => '',
'dbcollation' => 'utf8_unicode_ci',
);
$CFG->wwwroot = 'http://moodle.example.eu';
$CFG->dirroot = '/var/www/html/moodle';
$CFG->dataroot = '/var/www/moodledata';
$CFG->admin = 'admin';
$CFG->directorypermissions = 02777;
require_once(__DIR__ . '/lib/setup.php');
$CFG->reverseproxy = true;
// There is no php closing tag in this file,
// it is intentional because it prevents trailing whitespace problems!
Moodle has been installed following steps from the link below
https://www.vultr.com/docs/how-to-install-moodle-on-centos-7