Ricerca nel sito web

Come installare Joomla con Apache e crittografare SSL su Debian 10


Questo tutorial esiste per queste versioni del sistema operativo

  • Debian 10 (Buster)
  • Debian 9 (Stretch)

Su questa pagina

  1. Prerequisiti
  2. Per iniziare
  3. Installa il server LAMP
  4. Crea un database per Joomla
  5. Installa Joomla
  6. Configura il server Web Apache
  7. Accedi a Joomla
  8. Proteggi Joomla con Lets Encrypt SSL
  9. Conclusione

Joomla è un sistema di gestione dei contenuti gratuito e open source utilizzato per creare, modificare e gestire il contenuto di un sito web. È semplice e facile da usare, quindi non è necessario avere alcuna conoscenza di HTML o CSS per creare il sito web. È scritto in PHP e utilizza MySQL come database. Offre una vasta gamma di funzionalità che lo rendono un sistema di gestione dei contenuti flessibile fin da subito. Viene fornito con centinaia di estensioni gratuite che ti consentono di personalizzare ed estendere la funzionalità.

In questo tutorial, ti mostrerò come installare Joomla CMS con Apache e Lets Encrypt su Debian 10.

Prerequisiti

  • Un server che esegue Debian 10.
  • Un nome di dominio valido indicato con l'IP del tuo server.
  • Il server è configurato con una password di root.

Iniziare

Innanzitutto, aggiorna i pacchetti di sistema alla versione aggiornata eseguendo il seguente comando:

apt-get update -y

Una volta aggiornati tutti i pacchetti, puoi procedere al passaggio successivo.

Installa LAMP Server

Successivamente, dovrai installare il server Web Apache, il database MariaDB, PHP e altre estensioni PHP sul tuo sistema. Puoi installarli tutti con il seguente comando:

apt-get install apache2 mariadb-server php openssl php-imagick php-common php-curl php-gd php-imap php-intl php-json php-ldap php-mbstring php-mysql php-pgsql php-smbclient php-ssh2 php-sqlite3 php-xml php-zip -y

Una volta installati tutti i pacchetti, puoi procedere al passaggio successivo.

Crea un database per Joomla

Joomla utilizza MySQL o MariaDB per archiviare il suo contenuto. Quindi dovrai creare un database e un utente per Joomla.

Innanzitutto, connettiti a MariaDB con il seguente comando:

mysql

Una volta connesso, crea un database e un utente con il seguente comando:

MariaDB [(none)]> CREATE DATABASE joomladb;
MariaDB [(none)]> GRANT ALL ON joomladb.* TO 'joomlauser'@'localhost' IDENTIFIED BY 'password';

Successivamente, scarica i privilegi ed esci da MariaDB con il seguente comando:

MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;

Una volta terminato, puoi procedere al passaggio successivo.

Installa Joomla

Successivamente, scarica l'ultima versione di Joomla con il seguente comando:

wget https://downloads.joomla.org/cms/joomla3/3-9-25/Joomla_3-9-25-Stable-Full_Package.tar.bz2

Una volta completato il download, crea una directory per Joomla all'interno della web root di Apache:

mkdir /var/www/html/joomla

Quindi, esegui il seguente comando per estrarre il file scaricato nella directory di Joomla:

bunzip2 Joomla_3-9-25-Stable-Full_Package.tar.bz2
tar -xvf Joomla_3-9-25-Stable-Full_Package.tar -C /var/www/html/joomla/

Quindi, imposta i permessi e la proprietà appropriati per la directory di Joomla con il seguente comando:

chown -R www-data:www-data /var/www/html/joomla
chmod -R 755 /var/www/html/joomla

Una volta terminato, puoi procedere al passaggio successivo.

Configura il server Web Apache

Successivamente, dovrai creare un file di configurazione dell'host virtuale Apache per ospitare Joomla.

Puoi crearlo con il seguente comando:

nano /etc/apache2/sites-available/joomla.conf

Aggiungi le seguenti righe:

<VirtualHost *:80>
   ServerName joomla.example.com 
   ServerAdmin 
   DocumentRoot /var/www/html/joomla
   <Directory /var/www/html/joomla>
	    Allowoverride all
   </Directory>
</VirtualHost>

Salva e chiudi il file, quindi abilita l'host virtuale Apache con il seguente comando:

a2ensite joomla

Successivamente, riavvia il servizio Apache per applicare le modifiche:

systemctl restart apache2

Successivamente, verifica lo stato di Apache con il seguente comando:

systemctl status apache2

Dovresti ottenere il seguente output:

? apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2021-03-22 09:26:20 UTC; 4s ago
     Docs: https://httpd.apache.org/docs/2.4/
  Process: 14495 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
 Main PID: 14499 (apache2)
    Tasks: 6 (limit: 4701)
   Memory: 18.8M
   CGroup: /system.slice/apache2.service
           ??14499 /usr/sbin/apache2 -k start
           ??14500 /usr/sbin/apache2 -k start
           ??14501 /usr/sbin/apache2 -k start
           ??14502 /usr/sbin/apache2 -k start
           ??14503 /usr/sbin/apache2 -k start
           ??14504 /usr/sbin/apache2 -k start

Mar 22 09:26:20 debian10 systemd[1]: Starting The Apache HTTP Server...

Accedi a Joomla

Ora, apri il tuo browser web e accedi all'interfaccia web di Joomla utilizzando l'URL http://joomla.example.com. Verrai reindirizzato alla seguente pagina:

Ora, fornisci il nome del tuo sito, l'indirizzo e-mail, il nome utente dell'amministratore, la password e fai clic sul pulsante Avanti. Dovresti vedere la seguente pagina:

Fornire il nome del database, il nome utente del database, la password e fare clic sul pulsante Avanti. Dovresti vedere la seguente pagina:

Ora conferma tutte le impostazioni e fai clic sul pulsante Installa per avviare l'installazione. Una volta completata l'installazione, dovresti vedere la seguente pagina:

Fare clic sulla cartella Rimuovi installazione. Dovresti vedere la seguente pagina:

Ora, fai clic sul pulsante Amministratore, dovresti vedere la pagina di accesso di Joomla:

Fornisci le tue credenziali di amministratore e fai clic sul pulsante Accedi, dovresti vedere il pannello di controllo di Joomla nell'immagine seguente:

Proteggi Joomla con Lets Encrypt SSL

È sempre una buona idea proteggere il tuo sito web con Lets Encrypt SSL. Dovrai installare il client Certbot per installare e gestire SSL. Puoi installarlo con il seguente comando:

apt-get install python3-certbot-apache -y

Una volta installato Certbot, esegui il seguente comando per proteggere il tuo sito web con Lets Encrypt SSL:

certbot --apache -d joomla.example.com

Ti verrà chiesto di fornire la tua email e di accettare i termini di servizio come mostrato di seguito:

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator standalone, Installer None
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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
Plugins selected: Authenticator apache, Installer apache
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for joomla.example.com
Enabled Apache rewrite module
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/joomla-le-ssl.conf
Enabled Apache socache_shmcb module
Enabled Apache ssl module
Deploying Certificate to VirtualHost /etc/apache2/sites-available/joomla-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/joomla-le-ssl.conf

Successivamente, seleziona se reindirizzare o meno il traffico HTTP su HTTPS come mostrato di seguito:

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

Digita 2 e premi Invio per installare Lets Encrypt SSL per il tuo sito web:

Enabled Apache rewrite module
Redirecting vhost in /etc/apache2/sites-enabled/joomla.conf to ssl vhost in /etc/apache2/sites-available/joomla-le-ssl.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://joomla.example.com

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=joomla.example.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/joomla.example.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/joomla.example.com/privkey.pem
   Your cert will expire on 2020-10-23. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot again
   with the "certonly" option. To non-interactively renew *all* of
   your certificates, run "certbot 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

Conclusione

Congratulazioni! hai installato con successo Joomla CMS sul server Debian 10. Ora puoi creare facilmente il tuo sito Web utilizzando Joomla. Non esitate a chiedermi se avete domande.