Moodle 網站架設
安裝基礎 Nginx + PHP7.2-FPM+MariaDB
要額外安裝以下套件:
apt install php7.2-soap
下載Moodle:
wget https://download.moodle.org/stable35/moodle-latest-35.tgz
tar xvf moodle-latest-35.tgz
給權限:
chown -R www-data: moodle/
MariaDB 新增設定:
nano /etc/mysql/mariadb.conf.d/50-server.cnf
innodb_file_per_table = 1
innodb_large_prefix = 1
innodb_file_format=barracuda
innodb_use_native_aio=0
service mysql restart
Moodle 的Nginx Conf有部分不同,以下為範例參考,請注意php部分:
server {
listen 80;
server_name moodle.example.com;
location / {
return 301 https://moodle.example.com$request_uri;
}
}
server {
server_name moodle.example.com;
listen 443 ssl http2;
ssl_certificate /etc/letsencrypt/live/moodle.example.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/moodle.example.com/privkey.pem; # managed by Certbot
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_dhparam /etc/ssl/certs/dhparam.pem;
ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA';
ssl_session_timeout 1d;
ssl_session_cache shared:SSL:50m;
ssl_stapling on;
ssl_stapling_verify on;
ssl_session_tickets on;
root /var/www/moodle.example.com;
index index.php index.html;
location / {
autoindex on;
try_files $uri $uri/ /index.php?$query_string;
}
location ~ /.well-known {
allow all;
}
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+\.php)(.*)$;
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
include fastcgi.conf;
fastcgi_intercept_errors on;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
}
location ~ /\.ht {
deny all;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
}
就可以正常使用囉~
阅读剩余
THE END