To use https (only) for Moodle with nginx

To make your moodle instance work on https only is pretty simple with nginx:

1. Create a folder to contain the ssl certificate and key at /etc/nginx/ssl

2. Configure your nginx server block as following:

3. Create a simlink to the server block and restart nginx:

$ sudo ln -s /etc/nginx/sites-available/mymoodlessl /etc/nginx/sites-enabled/mymoodlessl
$ sudo service nginx restart

4. Add/modify these two lines to your moodle's config.php:

$CFG->wwwroot   = '';

4. Do not enable "Use https for logins" in Site administration / ► Security / ► HTTP security

5. Done


Post a Comment