How to Install Moodle with Nginx on Ubuntu 22.04



How to Install Moodle with Nginx on Ubuntu 22.04

How to Install Moodle with Nginx on Ubuntu 22.04

Moodle is a free and open-source Learning Management System and CMS written in PHP. It allows tutors and instructors to create courses for their students and provides long-distance education and other online learning programs more accessible. Moodle offers a simple, user-friendly and custom dashboard that helps users access current, past, or future courses and review pending work. It is designed for teachers and educators who aim to provide technology-savvy education.

This tutorial will show you how to install Moodle with Nginx on Ubuntu 22.04.

Useful Links:
VPS/VDS – https://www.mivocloud.com/

WARNING – ANGLED BRACKETS AREN’T ALLOWED IN DESCRIPTION SO BE ATTENTIVE TO THE VIDEO IN NANO EDITOR

Commands Used:
apt-get install nginx mariadb-server -y
apt install software-properties-common ca-certificates lsb-release apt-transport-https -y
add-apt-repository ppa:ondrej/php
apt update
apt install php7.4 php7.4-fpm php7.4-common php7.4-mysql php7.4-gmp php7.4-curl php7.4-intl php7.4-mbstring php7.4-soap php7.4-xmlrpc php7.4-gd php7.4-xml php7.4-cli php7.4-zip unzip git curl -y
nano /etc/php/7.4/fpm/php.ini
systemctl restart php7.4-fpm

mysql
CREATE DATABASE moodledb;
CREATE USER ‘moodle’@’localhost’ IDENTIFIED BY ‘password’;
GRANT ALL ON moodledb.* TO ‘moodle’@’localhost’ WITH GRANT OPTION;
FLUSH PRIVILEGES;
EXIT;

nano /etc/mysql/mariadb.conf.d/50-server.cnf
innodb_file_format = Barracuda
innodb_file_per_table = 1
innodb_large_prefix = ON

systemctl restart mariadb
cd /var/www/html
git clone -b MOODLE_400_STABLE git://git.moodle.org/moodle.git moodle
mkdir -p /var/www/html/moodledata
chown -R www-data:www-data /var/www/html/moodle
chmod -R 755 /var/www/html/*
chown www-data:www-data /var/www/html/moodledata

nano /etc/nginx/conf.d/moodle.conf

server {
listen 80;
root /var/www/html/moodle;
index index.php index.html index.htm;
server_name moodle.example.com;

client_max_body_size 100M;
autoindex off;
location / {
try_files $uri $uri/ =404;
}

location /dataroot/ {
internal;
alias /var/www/html/moodledata/;
}

location ~ [^/].php(/|$) {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

nginx -t
systemctl restart nginx
systemctl status nginx
nano moodle/config.php

Comments are closed.