WonderCMS est un système de gestion de contenu gratuit, open-source, simple et léger permettant de créer des sites Web et des blogs simples. Il s'agit d'un CMS à fichier plat et ne nécessite aucune base de données. Le processus d'installation est très simple et ne nécessite aucune configuration initiale. Il offre un riche ensemble de fonctionnalités, notamment la prise en charge WYSIWYG, un cadre CSS flexible, une compatibilité SEO et bien d'autres.
Dans ce tutoriel, nous allons vous montrer comment installer WonderCMS sur CentOS 8 et le sécuriser avec Let's Encrypt SSL.
Prérequis
- Un serveur exécutant CentOS 8.
- Un mot de passe root est configuré sur votre serveur.
Installer Apache et PHP
Tout d'abord, installez le serveur Web Apache, PHP et les autres extensions PHP avec la commande suivante :
dnf install httpd php php-mysqlnd php-curl php-opcache php-xml php-xmlrpc php-gd php-mbstring php-zip php-json wget unzip git -y
Une fois l'installation terminée, ouvrez le fichier php.ini et modifiez quelques paramètres :
nano /etc/php.ini
Modifiez la valeur selon vos besoins :
memory_limit = 128M post_max_size = 32M upload_max_filesize = 16M max_execution_time = 300 date.timezone = Asia/Kolkata
Enregistrez et fermez le fichier lorsque vous avez terminé. Ensuite, démarrez le service Apache et redémarrez-le pour qu'il démarre après le redémarrage du système avec la commande suivante :
systemctl start httpd
systemctl enable httpd
Télécharger WonderCMS
Tout d'abord, téléchargez la dernière version de WonderCMS depuis le dépôt Git :
cd /var/www/html
git clone https://github.com/robiso/wondercms.git
Une fois le téléchargement terminé, donnez les autorisations appropriées au répertoire téléchargé avec la commande suivante :
chown -R apache:apache /var/www/html/wondercms
chmod -R 775 /var/www/html/wondercms
Configurer Apache pour WonderCMS
Commencez par créer un nouveau fichier de configuration d'hôte virtuel Apache pour WonderCMS avec la commande suivante :
nano /etc/httpd/conf.d/wondercms.conf
Ajoutez les lignes suivantes :
<VirtualHost *:80> ServerName wonder.linuxbuz.com DirectoryIndex index.php DocumentRoot /var/www/html/wondercms Redirect /wondercms/loginURL /loginURL ErrorLog /var/log/httpd/linuxbuz.com-error.log CustomLog /var/log/httpd/linuxbuz.com-access.log combined <Directory /var/www/html/wondercms> Options FollowSymLinks AllowOverride All Require all granted </Directory> </VirtualHost>
Enregistrez et fermez le fichier. Ensuite, redémarrez le service Apache avec la commande suivante :
systemctl restart httpd
Vous pouvez également vérifier l'état du service Apache avec la commande suivante :
systemctl status httpd
Vous devriez voir le résultat suivant :
? httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled) Drop-In: /usr/lib/systemd/system/httpd.service.d ??php-fpm.conf Active: active (running) since Wed 2020-02-19 08:51:34 EST; 1min 25s ago Docs: man:httpd.service(8) Main PID: 4716 (httpd) Status: "Total requests: 6; Idle/Busy workers 100/0;Requests/sec: 0.0759; Bytes served/sec: 812 B/sec" Tasks: 278 (limit: 12558) Memory: 43.1M CGroup: /system.slice/httpd.service ??4716 /usr/sbin/httpd -DFOREGROUND ??4718 /usr/sbin/httpd -DFOREGROUND ??4719 /usr/sbin/httpd -DFOREGROUND ??4720 /usr/sbin/httpd -DFOREGROUND ??4721 /usr/sbin/httpd -DFOREGROUND ??4935 /usr/sbin/httpd -DFOREGROUND Feb 19 08:51:34 centos8 systemd[1]: Starting The Apache HTTP Server...
Sécuriser WonderCMS avec Let's Encrypt SSL
Ensuite, installez le client Certbot Let's Encrypt avec la commande suivante :
wget https://dl.eff.org/certbot-auto
mv certbot-auto /usr/local/bin/certbot-auto
chown root /usr/local/bin/certbot-auto
chmod 0755 /usr/local/bin/certbot-auto
Maintenant, exécutez la commande suivante pour obtenir et installer un certificat SSL pour votre site Web WonderCMS.
certbot-auto --apache -d wonder.linuxbuz.com
La commande ci-dessus installera d'abord toutes les dépendances requises sur votre serveur. Une fois installé, il vous sera demandé de fournir une adresse e-mail et d'accepter les conditions d'utilisation comme indiqué ci-dessous :
Remarque :Si vous obtenez une erreur liée au certificat SSL, redémarrez le service Apache et exécutez à nouveau la commande ci-dessus.
Saving debug log to /var/log/letsencrypt/letsencrypt.log Plugins selected: Authenticator apache, Installer apache Enter email address (used for urgent renewal and security notices) (Enter 'c' to cancel): [email protected] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Please read the Terms of Service at https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must agree in order to register with the ACME server at https://acme-v02.api.letsencrypt.org/directory - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (A)gree/(C)ancel: A - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Would you be willing to share your email address with the Electronic Frontier Foundation, a founding partner of the Let's Encrypt project and the non-profit organization that develops Certbot? We'd like to send you email about our work encrypting the web, EFF news, campaigns, and ways to support digital freedom. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (Y)es/(N)o: Y Obtaining a new certificate Performing the following challenges: http-01 challenge for wonder.linuxbuz.com Waiting for verification... Cleaning up challenges Deploying Certificate to VirtualHost /etc/nginx/conf.d/wondercms.conf
Ensuite, vous devrez choisir de rediriger ou non le trafic HTTP vers HTTPS comme indiqué ci-dessous :
Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1: No redirect - Make no further changes to the webserver configuration. 2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for new sites, or if you're confident your site works on HTTPS. You can undo this change by editing your web server's configuration. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2
Tapez 2 et appuyez sur Entrée continuer. Une fois l'installation terminée, vous devriez voir la sortie suivante :
Redirecting all traffic on port 80 to ssl in /etc/nginx/conf.d/wondercms.conf - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Congratulations! You have successfully enabled https://wonder.linuxbuz.com You should test your configuration at: https://www.ssllabs.com/ssltest/analyze.html?d=wonder.linuxbuz.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at: /etc/letsencrypt/live/wonder.linuxbuz.com/fullchain.pem Your key file has been saved at: /etc/letsencrypt/live/wonder.linuxbuz.com/privkey.pem Your cert will expire on 2020-03-23. To obtain a new or tweaked version of this certificate in the future, simply run certbot-auto again with the "certonly" option. To non-interactively renew *all* of your certificates, run "certbot-auto renew" - If you like Certbot, please consider supporting our work by: Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate Donating to EFF: https://eff.org/donate-le
Configurer le pare-feu et SELinux
Ensuite, vous devrez créer une règle de pare-feu pour autoriser les services HTTP et HTTPS à partir de réseaux externes. Vous pouvez l'autoriser avec la commande suivante :
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
firewall-cmd --reload
Ensuite, vous devrez configurer SELinux pour WonderCMS. Vous pouvez configurer SELinux à l'aide de la commande suivante :
setsebool httpd_can_network_connect on -P
chcon -R -u system_u -t httpd_sys_rw_content_t -r object_r /var/www/html/wondercms
Enfin, redémarrez le service Apache pour appliquer les modifications :
systemctl restart httpd
Accéder à WonderCMS
Maintenant, ouvrez votre navigateur Web et tapez l'URL https://wonder.linuxbuz.com. Vous serez redirigé vers la page d'accueil de WonderCMS :
Maintenant, copiez le mot de passe de la page ci-dessus et cliquez sur le cliquer pour vous connecter bouton. Vous devriez voir la page suivante :
Collez le mot de passe et cliquez sur Connexion bouton. Vous devriez voir la page suivante :
Ensuite, cliquez sur Paramètres => Sécurité . Vous devriez voir la page suivante :
Modifiez votre URL de connexion, votre mot de passe et cliquez sur CHANGER MOT DE PASSE bouton.
Conclusion
Toutes nos félicitations! vous avez installé et sécurisé avec succès WonderCMS sur CentOS 8 avec Let's Encrypt SSL. Vous pouvez désormais héberger facilement votre propre blog et site Web à l'aide de WonderCMS.