|
|
| Zeile 1: |
Zeile 1: |
| == Deployment-Skript: Rsync für Moodle == | | ==asp net core== |
| Ersten Mal Installation von Moodle auf einem Produktionsserver.
| |
| Der folgende `rsync`-Befehl wird verwendet, um eine Moodle-Installation von einem lokalen Server auf einen Produktionsserver zu übertragen. Dabei werden sensible und unnötige Dateien ausgeschlossen:
| |
|
| |
|
| <syntaxhighlight lang="bash">
| | * ASP.NET Core | Projects | Bootcamp |
| rsync -avz --dry-run
| | * .NET Core MVC - The Complete Guide [E-commerce] |
| | |
| | |
| rsync -avz --delete \
| |
| --perms --times \
| |
| --exclude '.git/' \
| |
| --exclude '.gitignore' \
| |
| --exclude 'config.php' \
| |
| --exclude 'cache/' \
| |
| --exclude 'localcache/' \
| |
| --exclude 'muc/' \
| |
| --exclude 'sessions/' \
| |
| /var/www/moodle/ \
| |
| user@prod:/var/www/moodle/
| |
| | |
| | |
| </syntaxhighlight>
| |
| | |
| == nginx-Konfiguration für Moodle ==
| |
| Die folgende Konfiguration für den Nginx-Webserver ist für die Bereitstellung von Moodle
| |
| <pre>
| |
| sudo systemctl stop nginx
| |
| sudo certbot certonly --standalone -d lernen.ahrensburg.city
| |
| </pre>
| |
| <pre>
| |
| Moodle Einstellungen für Nginx auf dem Server Rechner
| |
| Ein Beispiel für eine einfache Nginx-Konfiguration für Moodle auf einem Server Rechner:
| |
| <pre>
| |
| sudo nano /etc/nginx/conf.d/moodle.conf
| |
| </pre>
| |
| | |
| <pre>
| |
| server {
| |
| listen 443 ssl;
| |
| server_name lernen.ahrensburg.city;
| |
| root /var/www/moodle/moodle;
| |
| index index.php index.html index.htm;
| |
| ssl_certificate /etc/letsencrypt/live/lernen.ahrensburg.city/fullchain.pem;
| |
| ssl_certificate_key /etc/letsencrypt/live/lernen.ahrensburg.city/privkey.pem;
| |
| | |
| location / {
| |
| try_files $uri $uri/ =404;
| |
| }
| |
| | |
| location ~ [^/]\.php(/|$) {
| |
| fastcgi_split_path_info ^(.+\.php)(/.+)$;
| |
| fastcgi_pass unix:/run/php/php8.4-fpm.sock;
| |
| fastcgi_index index.php;
| |
| include fastcgi_params;
| |
| fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
| |
| fastcgi_param PATH_INFO $fastcgi_path_info;
| |
| }
| |
| | |
| location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
| |
| expires max;
| |
| log_not_found off;
| |
| }
| |
| }
| |
| </pre>
| |
| | |
| == Moodledata-Verzeichnis erstellen ==
| |
| | |
| Das Verzeichnis `moodledata` ist für Moodle zwingend erforderlich und sollte außerhalb des Webroots liegen. Erstellen Sie das Verzeichnis und passen Sie die Berechtigungen an:
| |
| | |
| <syntaxhighlight lang="bash">
| |
| sudo mkdir -p /var/www/moodle/moodledata
| |
| sudo chown -R www-data:www-data /var/www/moodle/moodledata
| |
| sudo chmod -R 770 /var/www/moodle/moodledata
| |
| </syntaxhighlight>
| |
| | |
| Achten Sie darauf, dass das Verzeichnis nicht über den Webserver erreichbar ist, um die Sicherheit Ihrer Moodle-Installation zu gewährleisten.
| |