Download opencart from https://www.moodle.org
Then extract it in your root web directory
Read INSTALL.txt file to setup and install moodle
Setup with Nginx
|
1 |
teddy@teddy:~/Documents/works/moodle/upload$ sudo gedit /etc/nginx/sites-available/moodle.test |
Here is the content
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
server { listen 80; listen [::]:80; root /home/teddy/Documents/works/moodle; index index.php index.html index.htm; server_name www.moodle.test moodle.test; error_log /home/teddy/Documents/works/moodle/var/log/moodle_errors.log; access_log /home/teddy/Documents/works/moodle/var/log/moodle_access.log; location / { try_files $uri $uri/ =404; } location /dataroot/ { internal; alias /home/teddy/Documents/works/moodledata/; } location ~ [^/]\.php(/|$) { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php7.2-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } gzip on; gzip_disable "msie6"; gzip_comp_level 6; gzip_min_length 1100; gzip_buffers 16 8k; gzip_proxied any; gzip_types text/plain text/css text/js text/xml text/javascript application/javascript application/x-javascript application/json application/xml application/xml+rss image/svg+xml; gzip_vary on; } |
NOTE: Pay attention on these lines
|
1 2 3 4 |
location /dataroot/ { internal; alias /home/teddy/Documents/works/moodledata/; } |
I HAVE TO PUT THEM THERE. IF NOT, I’D GET SESSION PROBLEM AND THE STATIC FILES (JS AND CSS) PATH WOULD NOT BE RECOGNIZED
REF: https://www.sudutbaca.com/cara-install-moodle-di-debian-9-menggunakan-nginx-mariadb-php7-2-fpm/
XXXdon’t forget to create the log file in var/log/system.log
Then
|
1 |
teddy@teddy:~/Documents/works/moodle$ sudo ln -s /etc/nginx/sites-available/moodle.test /etc/nginx/sites-enabled/moodle.test |
Then
|
1 |
teddy@teddy:~/Documents/works/moodle$ sudo gedit /etc/hosts |
Insert this line:
|
1 2 3 |
... 127.0.0.1 moodle.test ... |
Then check the nginx config and restart nginx
|
1 2 3 4 5 |
teddy@teddy:~/Documents/works/moodle$ sudo nginx -t nginx: [warn] conflicting server name "" on 0.0.0.0:80, ignored nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful teddy@teddy:~/Documents/works/moodle$ sudo service nginx restart |
Set the files owner
|
1 |
teddy@teddy:~/Documents/works/moodle$ sudo chown www-data:www-data -R . |
Open it on your browser http://moodle.test. For the first time, it’ll install Moodle.
|
1 2 3 |
Web address: http://moodle.test Moodle directory: /home/teddy/Documents/works/moodle Data directory: /home/teddy/Documents/works/moodledata |
Note: Create a new database ‘moodle’ with collation ‘utf8mb4_general_ci’
I THINK I ALSO NEED TO CHANGE (NOT SURE) config.php THEN ADD THESE NEW LINES
|
1 2 3 4 5 6 7 8 |
... $CFG->xsendfile = 'X-Accel-Redirect'; $CFG->xsendfilealiases = array( '/dataroot/' => $CFG->dataroot ); require_once(__DIR__ . '/lib/setup.php'); ... |
Admin:
Admin page: http://moodle.test/my/


