(EM DESENVOLVIMENTO)
Versões avaliadas: Debian 10 + Moodle 3.10.3+
Site para download: https://download.moodle.org/
# apt install nginx-extras graphviz aspell ghostscript clamav git mlocate
php7.3 php7.3-ldap php-fpm php-cli php-mysql php-mbstring php-xmlrpc php-zip php-gd php-xml php-bcmath php-ldap php-pspell php-curl php-intl php-soap php7.3-memcached memcached
Criar a database
CREATE DATABASE IF NOT EXISTS moodle CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,ALTER ON moodle.* TO moodleuser@'%' IDENTIFIED BY 'INS_SENHA';
FLUSH PRIVILEGES;
Restringir execução de scripts para uma extensão.
# vi /etc/php/7.3/fpm/pool.d/www.conf
DE:
security.limit_extensions = .php .php3 .php4 .php5 .php7
PARA:
security.limit_extensions = .php
Crie a entrada moodle.conf
# vi /etc/nginx/sites-available/moodle.conf
server {
listen 80;
listen [::]:80;
client_max_body_size 20M;
charset utf-8;
access_log /var/log/nginx/moodle.access.log;
error_log /var/log/nginx/moodle.error.log;
root /home/www/moodle;
index index.php;
server_name ead.local.domain;
server_name ead.domain.com.br;
location / {
try_files $uri $uri/ =404;
autoindex on;
}
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
include fastcgi_params;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_read_timeout 300;
}
location /dataroot/ {
internal;
alias /home/www/moodledata/;
}
location ~ /\.ht {
deny all;
}
}
Usar o Nginx para entrega de arquivos.
# vi moodle/config-dist.php
$CFG->xsendfile = 'X-Accel-Redirect';
$CFG->xsendfilealiases = array(
'/dataroot/' => $CFG->dataroot
);
Criar o link
# ln -s /etc/nginx/sites-available/moodle.conf /etc/nginx/sites-enabled/moodle.conf
Testar as configurações e reiniciar o serviços
# nginx -t <- Se tudo ok reiniciar o serviço
# systemctl restart php7.3-fpm.service && systemctl restart nginx.service
# wget https://download.moodle.org/download.php/direct/stable310/moodle-latest-310.tgz
# tar zvxf moodle-latest-310.tgz
# chown -R www-data.www-data moodle
# chmod -R 0755 moodle
# cd moodle
Acesse via navegador
O diretório moodledata sera criado no diretório raiz com permissao www-data. Esse diretório pode estar em uma área separada, por exemplo em um storage.
drwxrwxrwx 10 www-data www-data 136 Apr 27 13:49 moodledata
GIT
# git clone -b MOODLE_{{Version3}}_STABLE git://git.moodle.org/moodle.git
O que o Cpanel faz é simplesmente fornecer uma interface Web para uma utilidade Unix cahamada crontab. Se tiver uma linha de comandos, pode configurar o crontab directamente usando o comando:
crontab -e
e adicionando algum dos comandos acima assim:
*/5 * * * * wget -q -O /dev/null http://exemplo.com/moodle/admin/cron.php
https://docs.moodle.org/all/pt_br/Instalando_plugins#Instalando_diretamente_do_diret.C3.B3rio_de_plugins_do_Moodle
HTTPS
Edite o arquivo config.php e ajuste o parametro http para https e adicione a linha sslproxy
$CFG->wwwroot = 'https://ead.domain.com.br';
$CFG->sslproxy = true;
Nota: Neste exemplo estou utilizando o haproxy com letsencrypt redirecionando para o site interno.