GNU/Linux >> Linux Esercitazione >  >> Cent OS

Come installare Vanila Forum e proteggerlo con Lets Encrypt su CentOS 8

Vanilla è un software per forum di comunità gratuito, open source e flessibile che può essere utilizzato per creare il proprio sito forum. È una soluzione per forum leggera e multilingue che ti aiuta a creare una comunità online in pochi minuti. È scritto in PHP e viene fornito con molti componenti aggiuntivi e temi. È ricco di funzionalità premium e utilizzato dai migliori marchi per coinvolgere i clienti, fidelizzare e ridurre i costi di supporto.

In questo tutorial impareremo come installare il forum Vanilla su CentOS 8 e proteggerlo con Let's Encrypt SSL.

Prerequisiti

  • Un server che esegue CentOS 8.
  • Una password di root è impostata sul tuo server.

Installa il server LEMP

Innanzitutto, dovrai installare il server web Nginx, il server di database MariaDB, PHP e altre estensioni PHP richieste nel tuo sistema. Puoi eseguire il comando seguente per installarli tutti:

dnf install nginx mariadb-server php php php-mysqlnd php-opcache php-xml php-xmlrpc php-gd php-mbstring php-json php-fpm php-curl php-pear php-openssl php-intl unzip -y

Dopo aver installato tutti i pacchetti, avvia il servizio Nginx, PHP-FPM e MariaDB e abilita l'avvio dopo il riavvio del sistema con il seguente comando:

systemctl start nginx
systemctl start php-fpm
systemctl start mariadb
systemctl enable nginx
systemctl enable php-fpm
systemctl enable mariadb

Configura il database MariaDB

Prima di iniziare, è una buona idea proteggere il tuo MariaDB. Puoi proteggerlo con il seguente script:

mysql_secure_installation

Rispondi a tutte le domande come mostrato di seguito:

Enter current password for root (enter for none):
Set root password? [Y/n] Y
New password:
Re-enter new password:
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y

Dopo aver protetto MariaDB, accedi alla shell MariaDB con il seguente comando:

mysql -u root -p

Fornisci la tua password di root MariaDB e crea un database e un utente per Vanilla con il seguente comando:

MariaDB [(none)]> CREATE DATABASE vanilladb CHARACTER SET utf8 COLLATE utf8_general_ci;
MariaDB [(none)]> CREATE USER 'vanilla'@'localhost' IDENTIFIED BY 'password';

Quindi, concedi tutti i privilegi al database Vanilla con il seguente comando:

MariaDB [(none)]> GRANT ALL PRIVILEGES ON vanilladb.* TO 'vanilla'@'localhost';

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

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

Scarica Vanilla Forum

Puoi scaricare l'ultima versione stabile del forum Vanilla dal suo sito Web ufficiale con il seguente comando:

wget https://open.vanillaforums.com/get/vanilla-core-3.3.zip

Una volta scaricato, decomprimi il file scaricato con il seguente comando:

unzip vanilla-core-3.3.zip

Quindi, sposta la directory estratta nella directory principale web di Nginx con il seguente comando:

mv package /var/www/html/vanilla

Quindi, cambia la proprietà della directory vanilla in Nginx:

chown -R nginx:nginx /var/www/html/vanilla

Una volta terminato, puoi procedere al passaggio successivo.

Configura pool PHP-FPM

Per impostazione predefinita, PHP-FPM è configurato per Apache. Qui useremo Nginx come server web. Quindi dovrai configurare PHP-FPM per Nginx. Puoi farlo modificando il file /etc/php-fpm.d/www.conf:

nano /etc/php-fpm.d/www.conf

Modifica le seguenti righe:

user = nginx
group = nginx

Salva e chiudi il file quando hai finito. Quindi, crea una directory di sessione per PHP e modificane la proprietà:

mkdir -p /var/lib/php/session
chown -R nginx:nginx /var/lib/php/session

Quindi, riavvia il servizio PHP-FPM per applicare le modifiche:

systemctl restart php-fpm

Configura Nginx per Vanilla

Quindi, crea un nuovo file host virtuale Nginx per servire il forum Vanilla.

nano /etc/nginx/conf.d/vanilla.conf

Aggiungi le seguenti righe:

server {

  listen 80;
  server_name vanilla.linuxbuz.com;
  root /var/www/html/vanilla;
  index index.php;

  location ~* /\.git { deny all; return 403; }
  location /build/ { deny all; return 403; }
  location /cache/ { deny all; return 403; }
  location /cgi-bin/ { deny all; return 403; }
  location /uploads/import/ { deny all; return 403; }
  location /conf/ { deny all; return 403; }
  location /tests/ { deny all; return 403; }
  location /vendor/ { deny all; return 403; }

  location ~* ^/index\.php(/|$) {
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    try_files $fastcgi_script_name =404;
    set $path_info $fastcgi_path_info;
    fastcgi_param PATH_INFO $path_info;
    fastcgi_index index.php;
    include fastcgi.conf;
    fastcgi_param SCRIPT_NAME /index.php;
    fastcgi_param SCRIPT_FILENAME $realpath_root/index.php;
    fastcgi_param X_REWRITE 1;
    fastcgi_pass unix:/var/run/php-fpm/www.sock;
  }

  location ~* \.php(/|$) {
    rewrite ^ /index.php$uri last;
  }
  location / {
    try_files $uri $uri/ @vanilla;
  }

  location @vanilla {
    rewrite ^ /index.php$uri last;
  }

}

Salva e chiudi il file quando hai finito. Quindi, riavvia il servizio Nginx per applicare le modifiche:

systemctl restart nginx

Proteggi Vanilla con Let's Encrypt SSL

Successivamente, dovrai installare l'utilità Certbot nel tuo sistema per scaricare e installare Let's Encrypt SSL per il tuo sito Web Vanilla.

Puoi installare il client Certbot con il seguente comando:

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

Quindi, ottieni e installa un certificato SSL per il tuo sito Web Vanilla con il seguente comando:

certbot-auto --nginx -d vanilla.linuxbuz.com

Il comando precedente installerà prima tutte le dipendenze richieste sul tuo server. Una volta installato, ti verrà chiesto di fornire un indirizzo email e di accettare i termini del servizio come mostrato di seguito:

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator nginx, Installer nginx
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 vanilla.linuxbuz.com
Waiting for verification...
Cleaning up challenges
Deploying Certificate to VirtualHost /etc/nginx/conf.d/vanilla.conf

Seleziona se vuoi reindirizzare il traffico HTTP a HTTPS o meno 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 continuare. Una volta completata l'installazione, dovresti ottenere il seguente output:

Redirecting all traffic on port 80 to ssl in /etc/nginx/conf.d/vanilla.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://vanilla.linuxbuz.com

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

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/vanilla.linuxbuz.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/vanilla.linuxbuz.com/privkey.pem
   Your cert will expire on 2020-06-11. 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

Configura SELinux e Firewall

Per impostazione predefinita, SELinux è abilitato in CentOS 8. Quindi dovrai configurarlo per il tuo sito Web del forum Vanilla.

Puoi configurare SELinux con il seguente comando:

setsebool httpd_can_network_connect on -P
chcon -R -u system_u -t httpd_sys_rw_content_t -r object_r /var/www/html/vanilla

Quindi, consenti la porta 80 e 443 attraverso il firewall con il seguente comando:

firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
firewall-cmd --reload

Una volta terminato, puoi procedere al passaggio successivo.

Accedi al forum Vanilla

Apri il tuo browser web e visita l'URL https://vanilla.linuxbuz.com. Verrai reindirizzato alla seguente pagina:

Fornisci i dettagli del tuo database, il titolo dell'applicazione, l'e-mail, il nome utente dell'amministratore, la password e fai clic su Continua pulsante. Una volta terminata l'installazione, dovresti vedere la dashboard di Vanilla nella pagina seguente:

Conclusione

Congratulazioni! hai installato con successo il forum Vanilla su CentOS 8 con Let's Encrypt SSL. Ora puoi ospitare facilmente il tuo sito Web del forum della community. Sentiti libero di chiedermi se hai domande.


Cent OS
  1. Proteggi Nginx con Lets Encrypt su CentOS 7

  2. Come installare ownCloud 9.1 con Nginx e MariaDB su CentOS 7

  3. Come installare WordPress con HHVM e Nginx su CentOS 7

  4. Come installare OwnCloud 8 con Nginx e MariaDB su CentOS 7

  5. Come installare Shopware con NGINX e Lets Encrypt su CentOS 7

Come installare Drupal con Nginx e Lets Encrypt SSL su Ubuntu 20.04 LTS

Come installare Shopware 6 con Nginx e Lets Encrypt SSL su Ubuntu 20.04

Come installare ElkArte Forum con Apache e Lets Encrypt SSL su CentOS 8

Come installare Shopware 6 con NGINX e Lets Encrypt su CentOS 8

Come installare MyBB Forum con Nginx e Lets Encrypt su Debian 10

Come installare Vanila Forum su CentOS 8