Ricerca nel sito web

Come installare Joomla con Apache e consente di crittografare SSL su Ubuntu 22.04


Questo tutorial esiste per queste versioni del sistema operativo

  • Ubuntu 22.04 (Jammy Jellyfish)
  • Ubuntu 14.04 LTS (Trusty Tahr)

Su questa pagina

  1. Prerequisiti
  2. Installa il server LAMP
  3. Crea un database MySQL per Joomla
  4. Scarica Joomla
  5. Crea un host virtuale Apache per Joomla
  6. Accedi all'installazione web di Joomla
  7. Proteggi Joomla con Lets Encrypt SSL
  8. Conclusione

Joomla è un sistema di gestione dei contenuti gratuito, open source e pluripremiato che ti consente di creare siti Web e applicazioni Web online. È scritto in PHP e utilizza MySQL come backend del database. Joomla offre alcune eccellenti funzionalità che aiutano gli utenti a organizzare e gestire i contenuti in modo efficiente. È estendibile, facile da usare, adatto ai motori di ricerca e fornisce un'interfaccia web intuitiva per gestire il tuo sito Web dalla posizione centrale.

In questo post, ti mostreremo come installare Joomla CMS con Apache e Lets Encrypt SSL su Ubuntu 22.04.

Prerequisiti

  • Un server che esegue Ubuntu 22.04.
  • Un nome di dominio valido indicato con l'IP del tuo server.
  • Sul server è configurata una password di root.

Installa LAMP Server

Innanzitutto, installa il server Web Apache, il server del database MySQL e l'ultima versione di PHP con altre estensioni utilizzando il seguente comando:

apt install apache2 mysql-server php8.1 libapache2-mod-php8.1 php8.1-dev php8.1-bcmath php8.1-intl php8.1-soap php8.1-zip php8.1-curl php8.1-mbstring php8.1-mysql php8.1-gd php8.1-xml unzip -y

Una volta installati tutti i pacchetti, verificare la versione PHP utilizzando il seguente comando:

php -v

Dovresti vedere il seguente output:

PHP 8.1.2 (cli) (built: Apr  7 2022 17:46:26) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.2, Copyright (c), by Zend Technologies

Una volta terminato, puoi procedere al passaggio successivo.

Crea un database MySQL per Joomla

Successivamente, dovrai creare un database e un utente per Joomla per archiviare il contenuto web. Innanzitutto, connettiti a MySQL con il seguente comando:

mysql

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

mysql> CREATE DATABASE joomladb;
mysql> CREATE USER 'joomlauser'@'localhost' IDENTIFIED BY 'securepassword';

Successivamente, concedi tutti i privilegi al database Joomla con il seguente comando:

mysql> GRANT ALL ON joomladb.* TO 'joomlauser'@'localhost';

Quindi, svuota la tabella dei privilegi ed esci da MySQL usando il seguente comando:

mysql> FLUSH PRIVILEGES;
mysql> EXIT;

Una volta terminato, puoi procedere al passaggio successivo.

Scarica Joomla

Al momento della stesura di questo tutorial, l'ultima versione di Joomla è la 4.2.1. Puoi scaricarlo dal suo sito Web ufficiale con il seguente comando:

wget https://downloads.joomla.org/cms/joomla4/4-1-2/Joomla_4-1-2-Stable-Full_Package.zip

Una volta completato il download, decomprimere il file scaricato nella directory root Web di Apache utilizzando il seguente comando:

unzip Joomla_4-1-2-Stable-Full_Package.zip -d /var/www/html/joomla

Successivamente, modifica la proprietà e l'autorizzazione 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.

Crea un host virtuale Apache per Joomla

Successivamente, dovrai creare un file di configurazione dell'host virtuale Apache per Joomla. Puoi crearlo con il seguente comando:

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

Aggiungi le seguenti righe:

<VirtualHost *:80>

ServerAdmin 

ServerName joomla.example.com
DocumentRoot /var/www/html/joomla

<Directory /var/www/html/joomla/>
        Options FollowSymlinks
        AllowOverride All
        Require all granted
</Directory>

ErrorLog ${APACHE_LOG_DIR}/example.com_error.log
CustomLog ${APACHE_LOG_DIR}/example.com_access.log combined

</VirtualHost>

Salva e chiudi il file quindi attiva l'host virtuale di Joomla con il seguente comando:

a2ensite joomla.conf

Successivamente, riavvia il servizio Apache per applicare le modifiche:

systemctl restart apache2

Puoi anche controllare lo stato del servizio Apache con il seguente comando:

systemctl status apache2

Otterrai il seguente output:

? apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2022-04-29 07:59:59 UTC; 4s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 16393 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 16398 (apache2)
      Tasks: 6 (limit: 4630)
     Memory: 13.8M
        CPU: 129ms
     CGroup: /system.slice/apache2.service
             ??16398 /usr/sbin/apache2 -k start
             ??16399 /usr/sbin/apache2 -k start
             ??16400 /usr/sbin/apache2 -k start
             ??16401 /usr/sbin/apache2 -k start
             ??16402 /usr/sbin/apache2 -k start
             ??16403 /usr/sbin/apache2 -k start

Apr 29 07:59:59 ubuntu systemd[1]: Starting The Apache HTTP Server...

Una volta completato, puoi procedere al passaggio successivo.

Accedi all'installazione web di Joomla

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

Seleziona la lingua, definisci il nome del tuo sito e fai clic su Imposta dati di accesso. Dovresti vedere la seguente pagina:

Fornisci il tuo vero nome, nome utente, password, indirizzo e-mail e fai clic su Imposta connessione database. Dovresti vedere la seguente pagina:

Fornisci il nome del database, il nome utente del database, l'host, la password e fai clic sul pulsante Installa Joomla. Una volta installato Joomla, otterrai la seguente pagina:

Fare clic su Apri amministratore. Dovresti vedere la pagina di accesso di Joomla:

Fornisci il nome utente e la password dell'amministratore e fai clic sul pulsante Accedi. Dovresti vedere la dashboard di Joomla nella pagina 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 2023-01-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

Ora puoi accedere al tuo sito Web in modo sicuro utilizzando l'URL https://joomla.example.com.

Conclusione

Congratulazioni! hai installato correttamente Joomla con Apache e Lets Encrypt SSL su Ubuntu 22.04. Ora puoi facilmente creare e ospitare un sito Web utilizzando la piattaforma Joomla. Non esitate a chiedermi se avete domande.