# Setting up Moodle using nginx, postgresql and php on a newly installed Ubuntu 20.04 # All commands are issued as root user, working directory is /root apt update apt install joe nginx certbot python3-certbot-nginx postgresql php-common php-fpm \ php-pgsql php-xml php-soap php-curl php-intl php-gd php-zip php-mbstring php-xmlrpc ufw default deny incoming; ufw default allow outgoing; ufw allow OpenSSH; ufw allow 'Nginx Full'; ufw enable; joe /etc/nginx/sites-available/default -----------delete contents and cut and paste the following lines to it ------- server { listen 80; listen [::]:80; root /var/www/html; index index.php index.html index.htm; server_name microhope.in; # for Moodle client_max_body_size 10m; # for PHP7.4 access location ~[^/]\.php(/|$) { include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; fastcgi_read_timeout 600; } } ------------------------- systemctl restart nginx # get the Letsencript TLS Certificate certbot --nginx -d microhope.in To test, connect to https://microhope.in/index.nginx-debian.html joe /etc/php/7.4/fpm/php.ini ----------- modify parameters ------ post_max_size = 10M upload_max_filesize = 10M max_execution_time = 600 ----------- systemctl restart php7.4-fpm.service # Set the postgres HBA configuration to allow a connection using IP protocol joe /etc/postgresql/12/main/pg_hba.conf -------- add below # IPv4 local connections----------- host moodle moouser 127.0.0.1/32 password local moodle moouser password --------------- /etc/init.d/postgresql restart # Become the postgres user to create the moodle database and user. sudo -su postgres $ psql postgres=# create database moodle; postgres=# create user moouser password 'moo123'; postgres=# grant all on database moodle to moouser; postgres=# \q exit #from the home directory git clone -b MOODLE_39_STABLE git://git.moodle.org/moodle.git cp -r moodle /var/www/html chmod 777 /var/www/html/moodle # change this back to 755 after the installation is over mkdir /var/www/moodledata chown www-data:www-data /var/www/moodledata To start the installation, connect browser to https://microhope.in/moodle Follow the instructions