Ricerca nel sito web

Come installare il forum phpBB con Apache e Lets Encrypt SSL gratuito su Ubuntu 22.04


Su questa pagina

  1. Prerequisiti
  2. Installa Apache, MariaDB e PHP
  3. Crea un database per phpBB
  4. Scarica phpBB
  5. Configura Apache per phpBB
  6. Accedi all'interfaccia web di phpBB
  7. Proteggi phpBB con Lets Encrypt SSL
  8. Conclusione

phpBB è un software per forum gratuito e open source che offre uno spazio in cui le persone possono riunirsi e comunicare tra loro. È scritto in PHP e utilizza MariaDB come backend del database. Offre un ricco set di funzionalità, inclusi forum secondari, gruppi di utenti, ricerca full-text, plug-in e notifiche e-mail. È completamente scalabile e personalizzabile e ha un'interfaccia user-friendly e opzioni di gestione semplici.

Questo post ti mostrerà come installare phpBB 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 Apache, MariaDB e PHP

Innanzitutto, dovrai installare il server web Apache, il server del database MariaDB, PHP e altri pacchetti sul tuo server. Puoi installarli tutti eseguendo il seguente comando:

apt install apache2 mariadb-server php libapache2-mod-php php-gd php-curl openssl php-imagick php-intl php-json php-ldap php-common php-mbstring php-mysql php-imap php-sqlite3 php-net-ftp php-zip unzip php-pgsql php-ssh2 php-xml wget unzip -y

Una volta installati tutti i pacchetti, avviare e abilitare il servizio Apache con il seguente comando:

systemctl start apache2
systemctl enable apache2

Crea un database per phpBB

phpBB utilizza un MariaDB per archiviare i propri dati. Quindi dovrai creare un database e un utente per phpBB. Innanzitutto, accedi alla shell MariaDB con il seguente comando:

mysql

Una volta effettuato l'accesso, creare un database e un utente con il seguente comando:

MariaDB [(none)]> CREATE DATABASE phpdb;
MariaDB [(none)]> GRANT ALL ON phpdb.* to 'phpuser'@'localhost' IDENTIFIED BY 'password';

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

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

Al termine, puoi procedere al passaggio successivo.

Scarica phpBB

Successivamente, dovrai scaricare l'ultima versione di phpBB dalla loro pagina di download ufficiale. Puoi scaricarlo con il seguente comando:

wget https://download.phpbb.com/pub/release/3.3/3.3.7/phpBB-3.3.7.zip

Una volta scaricato il phpBB, decomprimere il file scaricato con il seguente comando:

unzip phpBB-3.3.7.zip

Successivamente, sposta la directory estratta nella directory principale del Web Apache:

mv phpBB3 /var/www/html/phpbb

Quindi, modifica la proprietà e l'autorizzazione della directory phpbb:

chown -R www-data:www-data /var/www/html/phpbb
chmod -R 775 /var/www/html/phpbb

Al termine, puoi procedere al passaggio successivo.

Configura Apache per phpBB

Successivamente, è necessario creare un file di configurazione dell'host virtuale Apache per ospitare phpBB. Puoi crearlo con il seguente comando:

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

Aggiungi le seguenti righe:

<VirtualHost *:80>
      ServerAdmin 
      DocumentRoot /var/www/html/phpbb
      ServerName phpbb.example.com

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

ErrorLog ${APACHE_LOG_DIR}/phpbb_error.log
CustomLog ${APACHE_LOG_DIR}/phpbb_access.log combined


</VirtualHost>

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

a2ensite phpbb
a2enmod rewrite

Successivamente, riavvia il servizio Apache per applicare le modifiche:

systemctl restart apache2

Puoi anche controllare lo stato del servizio Apache usando 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 Sat 2022-05-28 10:50:04 UTC; 2s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 22212 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 22217 (apache2)
      Tasks: 6 (limit: 2292)
     Memory: 15.8M
        CPU: 98ms
     CGroup: /system.slice/apache2.service
             ??22217 /usr/sbin/apache2 -k start
             ??22218 /usr/sbin/apache2 -k start
             ??22219 /usr/sbin/apache2 -k start
             ??22220 /usr/sbin/apache2 -k start
             ??22221 /usr/sbin/apache2 -k start
             ??22222 /usr/sbin/apache2 -k start

May 28 10:50:04 ubuntu2204 systemd[1]: Starting The Apache HTTP Server...

Accedi all'interfaccia web di phpBB

Ora, apri il tuo browser web e accedi all'interfaccia web di phpBB usando l'URL http://phpbb.example.com. Dovresti vedere la seguente pagina:

Fare clic sulla scheda INSTALLA e fare clic sul pulsante Installa per avviare l'installazione. Dovresti vedere la seguente pagina:

Fornisci il nome utente e la password dell'amministratore e fai clic sul pulsante Invia. Dovresti vedere la seguente pagina:

Fornisci l'host del database, la porta, il nome del database, il nome utente, la password e fai clic sul pulsante Invia. Dovresti vedere la seguente pagina:

Fornisci il tuo protocollo, il nome del dominio del sito web, la porta, il percorso e fai clic sul pulsante Invia. Dovresti vedere la seguente pagina:

Fornisci i tuoi dettagli SMTP e fai clic sul pulsante Invia. Dovresti vedere la seguente pagina:

Seleziona la lingua, il nome della bacheca, la descrizione della bacheca e fai clic sul pulsante Invia. Dovresti vedere la seguente pagina:

Fare clic sul pulsante Portami all'ACP. Dovresti vedere il pannello di controllo di phpBB nella pagina seguente:

Proteggi phpBB 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 phpbb.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 phpbb.example.com
Enabled Apache rewrite module
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/phpbb-le-ssl.conf
Enabled Apache socache_shmcb module
Enabled Apache ssl module
Deploying Certificate to VirtualHost /etc/apache2/sites-available/phpbb-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/phpbb-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/phpbb.conf to ssl vhost in /etc/apache2/sites-available/phpbb-le-ssl.conf

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

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

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

Conclusione

Congratulazioni! hai installato correttamente phpBB con Apache e Lets Encrypt SSL su Ubuntu 22.04. Ora puoi esplorare il pannello di controllo di phpBB e iniziare a creare la tua prima bacheca.