sudo apt update && sudo apt upgrade -y
Installez le serveur SSH :
sudo apt install -y openssh-server
Activez SSH et configurez les clés (optionnel pour plus de sécurité) :
ssh-keygen -t rsa -b 4096 ssh-copy-id user@your-server-ip
sudo apt install nginx
sudo systemctl enable nginx
sudo systemctl start nginx
sudo ufw allow OpenSSH sudo ufw allow 'Nginx Full' sudo ufw enable
Accédez à http://51.178.45.40 pour vérifier que Nginx est actif.
Créez un répertoire pour DokuWiki :
sudo mkdir -p /var/www/dokuwiki sudo chown -R www-data:www-data /var/www/dokuwiki
(www-data étant l'utilisateur système de Nginx)
sudo apt install unzip wget https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz tar -xvzf dokuwiki-stable.tgz sudo mv dokuwiki-2*/ /var/www/dokuwiki
Créez un fichier de configuration Nginx :
sudo nano /etc/nginx/sites-available/dokuwiki
Contenu du fichier:
server {
listen 80;
server_name phitalys.fun www.phitalys.fun;
root /var/www/dokuwiki;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /doku.php;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.3-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
Activez la configuration :
sudo ln -s /etc/nginx/sites-available/dokuwiki /etc/nginx/sites-enabled/ sudo systemctl reload nginx
sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d phitalys.fun -d www.phitalys.fun
Suivez les instructions et choisissez de forcer la redirection HTTPS si demandé.
Vérifiez que le certificat est valide en accédant à https://phitalys.fun. Ajoutez une tâche de renouvellement automatique (Certbot le configure souvent automatiquement) :
sudo certbot renew --dry-run
sudo apt install php-fpm php-cli php-xml php-mbstring
sudo systemctl restart php8.3-fpm sudo systemctl restart nginx
Créez un compte admin. Configurez les paramètres de base du wiki.
Créez un script dans le répertoire personnel :
nano ~/backup_dokuwiki.sh
Contenu du script :
#!/bin/bash rsync -avz /var/www/dokuwiki /var/dokubackups/
Rendez le script exécutable :
sudo mkdir /var/dokubackups/ chmod +x ~/backup_dokuwiki.sh sudo chown ubuntu:ubuntu /var/dokubackups/
Ouvrez le fichier cron :
crontab -e
Ajoutez la ligne suivante pour une sauvegarde quotidienne à 2h du matin :
0 2 * * * /bin/bash ~/backup_dokuwiki.sh
sudo apt install fail2ban sudo systemctl enable fail2ban
sudo apt install unattended-upgrades sudo dpkg-reconfigure --priority=low unattended-upgrades