GNU/Linux >> Linux Esercitazione >  >> Debian

Come installare Drupal con Apache e Lets Encrypt SSL su Debian 11

Drupal è un sistema di gestione dei contenuti gratuito e open source basato sullo stack LAMP. Drupal ha ottime funzionalità standard che ti consentono di creare potenti siti Web e blog. Viene fornito con molti temi, plug-in e widget che ti aiutano a creare un sito Web senza alcuna conoscenza di programmazione. Fornisce molte funzionalità come supporto multisito, supporto multilingue, sistema di commenti, feed RSS, registrazione utenti e altro.

In questo post, ti mostreremo come installare Drupal CMS con Apache e Let's Encrypt SSL su Debian 11.

Prerequisiti

  • Un server che esegue Debian 11.
  • Un nome di dominio valido puntato all'IP del tuo server.
  • Sul server è configurata una password di root.

Installa lo stack LAMP

Drupal si basa sullo stack LAMP. Quindi lo stack LAMP deve essere installato nel tuo server. Se non è installato, puoi installarlo eseguendo il seguente comando:

apt-get install apache2 mariadb-server mariadb-client php libapache2-mod-php php-cli php-mysql php-zip php-gd php-fpm php-json php-common php-intl php-mbstring php-curl php-xml php-pear php-tidy php-soap php-bcmath php-xmlrpc -y

Una volta installato lo stack LAMP, modifica il file php.ini e cambia alcune impostazioni predefinite:

nano /etc/php/7.4/apache2/php.ini

Modifica le seguenti righe:

memory_limit = 256M
upload_max_filesize = 32M
max_execution_time = 300
date.timezone = Asia/Kolkata

Salva e chiudi il file quando hai finito.

Crea un database Drupal

Drupal utilizza un MariaDB come backend del database. Quindi dovrai creare un database e un utente per Drupal.

Innanzitutto, accedi a MariaDB con il seguente comando:

mysql

Una volta effettuato l'accesso, crea un database e un utente utilizzando il seguente comando:

MariaDB [(none)]> CREATE DATABASE drupaldb;
MariaDB [(none)]> CREATE USER 'drupaluser'@'localhost' IDENTIFIED BY "securepassword";

Quindi, concedi tutti i privilegi al database Drupal usando il seguente comando:

MariaDB [(none)]> GRANT ALL ON drupaldb.* TO 'drupaluser'@'localhost' IDENTIFIED BY "securepassword";

Quindi, svuota i privilegi ed esci da MariaDB con il seguente comando:

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

Scarica Drupal

Per prima cosa, vai sul sito Web di Drupal, scegli l'ultima versione di Drupal e scaricala con il seguente comando:

wget https://www.drupal.org/download-latest/tar.gz -O drupal.tar.gz

Una volta scaricato il Drupal, estrai il file scaricato con il seguente comando:

tar -xvf drupal.tar.gz

Quindi, sposta la directory estratta nella directory radice predefinita di Apache:

mv drupal-* /var/www/html/drupal

Quindi, modifica la proprietà e l'autorizzazione della directory Drupal utilizzando il comando seguente:

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

Crea un host virtuale Apache per Drupal

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

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

Aggiungi le seguenti righe:

<VirtualHost *:80>
     ServerAdmin [email protected]
     DocumentRoot /var/www/html/drupal/
     ServerName  drupal.example.com  

     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined

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

     <Directory /var/www/html/>
            RewriteEngine on
            RewriteBase /
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
    </Directory>
</VirtualHost>

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

a2ensite drupal.conf
a2enmod rewrite

Quindi, riavvia il servizio Apache per applicare le modifiche:

systemctl restart apache2

Per controllare lo stato di Apache, esegui 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 Sat 2021-09-18 14:59:40 UTC; 5s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 19698 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 19703 (apache2)
      Tasks: 6 (limit: 2341)
     Memory: 15.3M
        CPU: 78ms
     CGroup: /system.slice/apache2.service
             ??19703 /usr/sbin/apache2 -k start
             ??19704 /usr/sbin/apache2 -k start
             ??19705 /usr/sbin/apache2 -k start
             ??19706 /usr/sbin/apache2 -k start
             ??19707 /usr/sbin/apache2 -k start
             ??19708 /usr/sbin/apache2 -k start

A questo punto, il server web Apache è configurato per servire Drupal. Ora puoi procedere al passaggio successivo.

Accedi al sito web Drupal

Ora apri il tuo browser web e accedi a Drupal utilizzando l'URL http://drupal.example.com . Verrai reindirizzato alla seguente pagina:

Scegli la lingua inglese e fai clic su Salva e continua pulsante, dovresti vedere la seguente immagine:

Seleziona un profilo di installazione e fai clic su Salva e continua pulsante. Dovresti vedere la seguente pagina:

Nella pagina Configurazione database, fornisci tutti i dettagli del database richiesti come nome del database, nome utente e password del database, host del database, quindi fai clic su Salva e continua pulsante, dovresti vedere la seguente immagine:

Nella pagina di configurazione del sito Drupal, fornisci il nome del tuo sito, il nome utente e la password dell'amministratore, quindi fai clic su Salva e continua pulsante per avviare l'installazione di Drupal. Una volta installato Drupal, dovresti vedere la dashboard di Drupal nell'immagine seguente:

Abilita il supporto SSL Let's Encrypt sul sito web Drupal

È sempre una buona idea proteggere il tuo sito Web con Let's Encrypt SSL. Innanzitutto, dovrai installare il client Certbot per installare e gestire SSL. Per impostazione predefinita, il pacchetto Certbot è incluso nel repository predefinito di Debian 11, quindi puoi installarlo con il seguente comando:

apt-get install python3-certbot-apache -y

Una volta installato Certbot, esegui il comando seguente per proteggere il tuo sito Web con Let's Encrypt SSL:

certbot --apache -d drupal.example.com

Ti verrà chiesto di fornire la tua email e di accettare i termini del 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): [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
Plugins selected: Authenticator apache, Installer apache
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for drupal.example.com
Enabled Apache rewrite module
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/drupal-le-ssl.conf
Enabled Apache socache_shmcb module
Enabled Apache ssl module
Deploying Certificate to VirtualHost /etc/apache2/sites-available/drupal-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/drupal-le-ssl.conf

Quindi, 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 Let's Encrypt SSL per il tuo sito web:

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

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

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

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/drupal.example.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/drupal.example.com/privkey.pem
   Your cert will expire on 2021-04-20. 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

Per ora è tutto. Hai installato con successo Drupal con Let's Encrypt SSL su Debian 11. Ora puoi iniziare a creare il tuo blog o sito web senza alcuna conoscenza di programmazione. Sentiti libero di chiedermi se hai domande.


Debian
  1. Come installare e configurare Drupal con Apache su Debian 9

  2. Come installare Tiki Wiki con Apache e Lets crittografa SSL su Debian 10

  3. Come installare Automatad CMS con Apache e Lets crittografare su Debian 10

  4. Come installare ElkArte Forum con Apache e Lets Encrypt su Debian 10

  5. Come installare WonderCMS con Apache e Lets Encrypt SSL su CentOS 8

Come installare SuiteCRM con Apache e Lets Encrypt SSL gratuito su Debian 11

Come installare InvoicePlane con Apache e Free Lets Encrypt SSL Certificate su Debian 11

Come installare Lighttpd con PHP, MariaDB e Lets Encrypt SSL su Debian 10

Come installare Wekan Kanban con Nginx e Lets Encrypt SSL su Debian 10

Come installare WordPress con Apache e Let's Encrypt SSL su Debian 11

Come installare Drupal con Nginx e Let's Encrypt SSL su Debian 11