GNU/Linux >> Tutoriales Linux >  >> Cent OS

Cómo instalar Vanila Forum y asegurarlo con Lets Encrypt en CentOS 8

Vanilla es un software de foro comunitario gratuito, de código abierto y flexible que se puede utilizar para crear su propio sitio de foro. Es una solución de foro liviana y multilingüe que lo ayuda a configurar una comunidad en línea en minutos. Está escrito en PHP y viene con muchos complementos y temas. Está repleto de funciones premium y lo utilizan las mejores marcas para captar clientes, generar lealtad y reducir los costos de soporte.

En este tutorial, aprenderemos cómo instalar el foro Vanilla en CentOS 8 y asegurarlo con Let's Encrypt SSL.

Requisitos

  • Un servidor que ejecuta CentOS 8.
  • Se ha configurado una contraseña de root en su servidor.

Instalar servidor LEMP

Primero, deberá instalar el servidor web Nginx, el servidor de base de datos MariaDB, PHP y otras extensiones de PHP requeridas en su sistema. Puede ejecutar el siguiente comando para instalarlos todos:

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

Después de instalar todos los paquetes, inicie el servicio Nginx, PHP-FPM y MariaDB y habilítelos para que se inicien después de reiniciar el sistema con el siguiente comando:

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

Configurar base de datos MariaDB

Antes de comenzar, es una buena idea asegurar su MariaDB. Puede asegurarlo con el siguiente script:

mysql_secure_installation

Responda todas las preguntas como se muestra a continuación:

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

Después de proteger MariaDB, inicie sesión en el shell de MariaDB con el siguiente comando:

mysql -u root -p

Proporcione su contraseña raíz de MariaDB y cree una base de datos y un usuario para Vanilla con el siguiente comando:

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

A continuación, otorgue todos los privilegios a la base de datos Vanilla con el siguiente comando:

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

A continuación, elimine los privilegios y salga del shell de MariaDB con el siguiente comando:

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

Descargar Foro Vanilla

Puede descargar la última versión estable del foro Vanilla desde su sitio web oficial con el siguiente comando:

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

Una vez descargado, descomprima el archivo descargado con el siguiente comando:

unzip vanilla-core-3.3.zip

A continuación, mueva el directorio extraído al directorio raíz web de Nginx con el siguiente comando:

mv package /var/www/html/vanilla

A continuación, cambie la propiedad del directorio vanilla a Nginx:

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

Una vez que haya terminado, puede continuar con el siguiente paso.

Configurar grupo PHP-FPM

Por defecto, PHP-FPM está configurado para Apache. Aquí, usaremos Nginx como servidor web. Por lo tanto, deberá configurar PHP-FPM para Nginx. Puede hacerlo editando el archivo /etc/php-fpm.d/www.conf:

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

Cambie las siguientes líneas:

user = nginx
group = nginx

Guarde y cierre el archivo cuando haya terminado. Luego, cree un directorio de sesión para PHP y cambie su propiedad:

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

A continuación, reinicie el servicio PHP-FPM para aplicar los cambios:

systemctl restart php-fpm

Configurar Nginx para Vanilla

A continuación, cree un nuevo archivo de host virtual de Nginx para servir en el foro de Vanilla.

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

Agregue las siguientes líneas:

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;
  }

}

Guarde y cierre el archivo cuando haya terminado. Luego, reinicie el servicio Nginx para aplicar los cambios:

systemctl restart nginx

Secure Vanilla con Let's Encrypt SSL

A continuación, deberá instalar la utilidad Certbot en su sistema para descargar e instalar Let's Encrypt SSL para su sitio web Vanilla.

Puede instalar el cliente Certbot con el siguiente 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

Luego, obtenga e instale un certificado SSL para su sitio web Vanilla con el siguiente comando:

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

El comando anterior instalará primero todas las dependencias requeridas en su servidor. Una vez instalado, se le pedirá que proporcione una dirección de correo electrónico y acepte el término del servicio como se muestra a continuación:

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

Seleccione si desea redirigir el tráfico HTTP a HTTPS o no, como se muestra a continuación:

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

Tipo 2 y pulsa Intro continuar. Una vez que la instalación se haya completado con éxito, debería obtener el siguiente resultado:

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

Configurar SELinux y Firewall

De manera predeterminada, SELinux está habilitado en CentOS 8. Por lo tanto, deberá configurarlo para su sitio web del foro de Vanilla.

Puede configurar SELinux con el siguiente 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

Luego, permita el puerto 80 y 443 a través del firewall con el siguiente comando:

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

Una vez que haya terminado, puede continuar con el siguiente paso.

Acceder al Foro Vanilla

Abra su navegador web y visite la URL https://vanilla.linuxbuz.com. Será redirigido a la siguiente página:

Proporcione los detalles de su base de datos, el título de la aplicación, el correo electrónico, el nombre de usuario del administrador, la contraseña y haga clic en Continuar. botón. Una vez finalizada la instalación, debería ver el panel Vanilla en la siguiente página:

Conclusión

¡Felicidades! Ha instalado con éxito el foro Vanilla en CentOS 8 con Let's Encrypt SSL. Ahora puede alojar fácilmente su propio sitio web del foro de la comunidad. Siéntase libre de preguntarme si tiene alguna pregunta.


Cent OS
  1. Asegure Nginx con Lets Encrypt en CentOS 7

  2. Cómo instalar ownCloud 9.1 con Nginx y MariaDB en CentOS 7

  3. Cómo instalar WordPress con HHVM y Nginx en CentOS 7

  4. Cómo instalar OwnCloud 8 con Nginx y MariaDB en CentOS 7

  5. Cómo instalar Shopware con NGINX y Lets Encrypt en CentOS 7

Cómo instalar Drupal con Nginx y Lets Encrypt SSL en Ubuntu 20.04 LTS

Cómo instalar Shopware 6 con Nginx y Lets Encrypt SSL en Ubuntu 20.04

Cómo instalar ElkArte Forum con Apache y Lets Encrypt SSL en CentOS 8

Cómo instalar Shopware 6 con NGINX y Lets Encrypt en CentOS 8

Cómo instalar MyBB Forum con Nginx y Lets Encrypt en Debian 10

Cómo instalar Vanila Forum en CentOS 8