Cómo instalar foros Vanilla con Apache y Let’s Encrypt SSL en Ubuntu 20.04 LTS

Vanilla Forums es un software de foro comunitario gratuito y de código abierto escrito en PHP. Es un programa sencillo, flexible, personalizable y multilingüe que proporciona todas las funciones que necesitas para dirigir un foro con éxito. Ofrece muchos complementos, excelentes opciones de integración y temas para elegir. Viene con un rico conjunto de características que incluyen, inicio de sesión único, foros incrustables, inicio de sesión en redes sociales, importación desde otros foros, integración con otros proyectos FOSS y muchas más.

En este tutorial, aprenderemos a instalar el software Vanilla Forum con Apache y Let’s Encrypt en Ubuntu 20.04.

Requisitos previos

  • Un servidor con Ubuntu 20.04.
  • Un nombre de dominio válido apuntado con tu servidor.
  • Una contraseña de root configurada en tu servidor.

Instalar el servidor LAMP

En primer lugar, tendrás que instalar el servidor web Apache, MariaDB, PHP y otras extensiones necesarias en tu sistema. Puedes instalarlos todos con el siguiente comando:

apt-get install apache2 mariadb-server php7.4 libapache2-mod-php7.4 php7.4-common php7.4-mysql php7.4-cli php7.4-opcache php7.4-gd php7.4.intl php7.4-curl php7.4-cli php7.4-imap php7.4-mbstring php7.4-soap php7.4-xmlrpc php7.4-xml php7.4-zip unzip git wget -y

Una vez instalados todos los paquetes, edita el php.ini y establece algunos valores deseados:

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

Cambia las siguientes líneas:

memory_limit = 256M
upload_max_filesize = 100M
max_execution_time = 360
date.timezone = America/Chicago

Guarda y cierra el archivo cuando hayas terminado.

Configurar la base de datos MariaDB

A continuación, asegura la instalación de MariaDB y establece la contraseña de root de MariaDB utilizando el siguiente script:

mysql_secure_installation

Se te pedirán varias preguntas como se muestra a continuación:

Enter current password for root (enter for none): 
Set root password? [Y/n]: Y
New password: Enter password
Re-enter new password: Repeat 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

Una vez que la MariaDB esté asegurada, inicia sesión en la MariaDB con el usuario root:

mysql -u root -p

Una vez iniciada la sesión, crea una base de datos y un usuario para Vanilla utilizando el siguiente comando:

MariaDB [(none)]> CREATE DATABASE vanilladb;
MariaDB [(none)]> CREATE USER vanilla@localhost IDENTIFIED BY 'password';

A continuación, concede 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, vacía los privilegios y sal del shell de MariaDB con el siguiente comando:

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

En este punto, tu base de datos MariaDB está configurada para Vanilla.

Descargar Vanilla

En primer lugar, tendrás que descargar la última versión de Vanilla desde su sitio web oficial. En el momento de escribir este tutorial, la última versión disponible es Vanilla 3.3. Puedes descargarla con el siguiente comando:

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

Una vez completada la descarga, descomprime el archivo descargado con el siguiente comando:

unzip vanilla-core-3-3.zip

A continuación, mueve el directorio del paquete al directorio raíz de la web de Apache:

mv package /var/www/html/vanilla

A continuación, cambia la propiedad del directorio vanilla a www-data y dale los permisos adecuados con el siguiente comando:

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

Una vez que hayas terminado, puedes pasar al siguiente paso.

Configurar Apache para el Foro Vanilla

A continuación, tendrás que crear un nuevo archivo de configuración del host virtual de Apache para servir a Foro Vainilla.

Puedes crearlo con el siguiente comando:

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

Añade las siguientes líneas:

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

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

     ErrorLog /var/log/apache2/vanilla_error.log
     CustomLog /var/log/apache2/vanilla_access.log combined

</VirtualHost>

Guarda y cierra el archivo cuando hayas terminado. A continuación, habilita el archivo de host virtual y reinicia el servicio Apache para aplicar los cambios:

a2ensite vanilla.conf
systemctl reload apache2

También puedes verificar el estado del servicio Apache con el siguiente comando:

systemctl status apache2

Deberías obtener la siguiente salida:

? apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Thu 2020-06-25 07:42:29 UTC; 4min 35s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 16070 ExecReload=/usr/sbin/apachectl graceful (code=exited, status=0/SUCCESS)
   Main PID: 13697 (apache2)
      Tasks: 6 (limit: 2353)
     Memory: 23.5M
     CGroup: /system.slice/apache2.service
             ??13697 /usr/sbin/apache2 -k start
             ??16074 /usr/sbin/apache2 -k start
             ??16075 /usr/sbin/apache2 -k start
             ??16076 /usr/sbin/apache2 -k start
             ??16077 /usr/sbin/apache2 -k start
             ??16078 /usr/sbin/apache2 -k start

Jun 25 07:42:29 ubuntu20 systemd[1]: Starting The Apache HTTP Server...

En este punto, el servidor web Apache está configurado para servir a Vanilla Forum.

Asegura Vanilla Forum con Let’s Encrypt

También puedes asegurar tu sitio web de Vanilla Forum con Let’s Encrypt SSL. Antes de empezar, tendrás que instalar Certbot en tu sistema. Certbot es un cliente de Let’s Encrypt que se utiliza para instalar y gestionar Let’s Encrypt SSL.

Puedes instalar el cliente Certbot ejecutando el siguiente comando:

apt-get install certbot python3-certbot-apache -y

Una vez instalado el Certbot, ejecuta el siguiente comando para instalar el SSL de Let’s Encrypt para tu sitio web.

certbot --apache -d vanilla.linuxbuz.com

Se te pedirá que proporciones tu dirección de correo electrónico válida y que aceptes las condiciones del servicio, como se muestra a continuación:

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator apache, Installer apache
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
Enabled Apache rewrite module
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/vanilla-le-ssl.conf
Enabled Apache socache_shmcb module
Enabled Apache ssl module
Deploying Certificate to VirtualHost /etc/apache2/sites-available/vanilla-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/vanilla-le-ssl.conf

A continuación, también tendrás que elegir si quieres 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

Escribe 2 y pulsa Intro para instalar el SSL de Let’s Encrypt para tu dominio:

Enabled Apache rewrite module
Redirecting vhost in /etc/apache2/sites-enabled/vanilla.conf to ssl vhost in /etc/apache2/sites-available/vanilla-le-ssl.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-09-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"
 - Your account credentials have been saved in your Certbot
   configuration directory at /etc/letsencrypt. You should make a
   secure backup of this folder now. This configuration directory will
   also contain certificates and private keys obtained by Certbot so
   making regular backups of this folder is ideal.
 - 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

 - We were unable to subscribe you the EFF mailing list because your
   e-mail address appears to be invalid. You can try again later by
   visiting https://act.eff.org.

Ahora, tu sitio web de Vanilla Forum está protegido con Let’s Encrypt SSL.

Accede a Foro Vainilla

Ahora, abre tu navegador web y escribe la URL https://vanilla.linuxbuz.com. Deberías ver la siguiente pantalla:

Configuración de la base de datos

Configuración del foro

Proporciona los detalles de tu base de datos, el título de la aplicación, el correo electrónico, el nombre de usuario del administrador, la contraseña y haz clic en el botón Continuar. Deberías ver el panel de control de Vainilla en la siguiente pantalla:

Foro Vanilla instalado

Ahora, haz clic en el botón VISITAR SITIO. Deberías ver la siguiente pantalla:

Foro Vanilla en Ubuntu 20.04

Conclusión

Enhorabuena! has instalado con éxito el software de Vanilla Forum con Apache y lo has asegurado con Let’s Encrypt SSL gratuito. Ahora puedes alojar tu propio foro comunitario en un minuto. No dudes en preguntarme si tienes alguna duda.

También te podría gustar...