GNU/Linux >> Tutoriales Linux >  >> Debian

Cómo instalar DokuWiki con Lets Encrypt SSL en Debian 11

DokuWiki es una potente aplicación de software Wiki gratuita, de código abierto y escrita en PHP. Utiliza un archivo para almacenar sus datos en lugar de utilizar una base de datos. Es simple, liviano y le permite crear y editar un sitio web desde el navegador web. Ofrece muchas características que le permiten escalar y optimizar su sitio web fácilmente. Es utilizado por muchos usuarios debido a su sintaxis limpia y legible, facilidad de mantenimiento, copia de seguridad e integración.

En este tutorial, le mostraré cómo instalar DokuWiki con Apache y Let's Encrypt SSL en Debian 11.

Requisitos

  • Un servidor con Ubuntu 20.04.
  • Un nombre de dominio válido apuntado con la IP de su servidor.
  • Se configura una contraseña raíz en el servidor.

Cómo empezar

Antes de comenzar, se recomienda actualizar los paquetes de su sistema a la última versión. Puede actualizarlos ejecutando el siguiente comando:

apt-get update -y

Una vez que todos los paquetes estén actualizados, puede continuar con el siguiente paso.

Instalar Apache y PHP

DokuWiki se ejecuta en Apache o Nginx y está escrito en lenguaje PHP. Por lo tanto, deberá instalar Apache, PHP y otras extensiones requeridas en su servidor. Puede instalarlos ejecutando el siguiente comando:

apt-get install apache2 php php-gd php-xml php-json -y

Una vez que todos los paquetes estén instalados, inicie el servicio Apache y habilítelo para que se inicie al reiniciar el sistema:

systemctl start apache2
systemctl enable apache2

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

Instalar DokuWiki

Primero, vaya a la página de descarga de DokuWiki y descargue la última versión de DokuWiki usando el siguiente comando:

wget https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz

Una vez completada la descarga, cree un directorio para DokuWiki dentro del directorio raíz web de Apache:

mkdir /var/www/html/dokuwiki

A continuación, extrae el archivo descargado al directorio de DokuWiki con el siguiente comando:

tar -xvzf dokuwiki-stable.tgz -C /var/www/html/dokuwiki/ --strip-components=1

Luego, copie algunos archivos necesarios usando el siguiente comando:

cp /var/www/html/dokuwiki/.htaccess{.dist,}

A continuación, establezca la propiedad adecuada en el directorio DokuWiki:

chown -R www-data:www-data /var/www/html/dokuwiki

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

Crea un servidor virtual Apache para DokuWiki

A continuación, deberá crear un archivo de configuración de host virtual de Apache para alojar DokuWiki en Internet. Puede crearlo con el siguiente comando:

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

Agregue las siguientes líneas:

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

        <Directory ~ "/var/www/html/dokuwiki/(bin/|conf/|data/|inc/)">
            <IfModule mod_authz_core.c>
                AllowOverride All
                Require all denied
            </IfModule>
            <IfModule !mod_authz_core.c>
                Order allow,deny
                Deny from all
            </IfModule>
        </Directory>

        ErrorLog   /var/log/apache2/dokuwiki_error.log
        CustomLog  /var/log/apache2/dokuwiki_access.log combined
</VirtualHost>

Guarde y cierre el archivo, luego habilite el archivo de configuración del host virtual usando el siguiente comando:

a2ensite dokuwiki.conf

A continuación, vuelva a cargar Apache para aplicar los cambios.

systemctl reload apache2

También puede verificar el estado de Apache con el siguiente comando:

systemctl status apache2

Obtendrá el siguiente resultado:

? apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2021-10-24 04:01:29 UTC; 9min ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 27698 ExecReload=/usr/sbin/apachectl graceful (code=exited, status=0/SUCCESS)
      Tasks: 77 (limit: 4691)
     Memory: 12.5M
     CGroup: /system.slice/apache2.service
             ??21346 /usr/sbin/apache2 -k start
             ??27703 Passenger watchdog
             ??27706 Passenger core
             ??27711 Passenger ust-router
             ??27729 /usr/sbin/apache2 -k start
             ??27730 /usr/sbin/apache2 -k start

Asegure DokuWiki con Let's Encrypt SSL

Después de configurar Apache, se recomienda proteger su sitio wiki con un certificado SSL de Let's Encrypt. Para hacerlo, deberá instalar el cliente Certbot en su sistema. El Certbot es un cliente fácil de usar que obtiene un certificado de Let's Encrypt, una autoridad de certificación abierta lanzada por EFF, Mozilla y otros, y lo implementa en un servidor web. Con el cliente Certbot Let's Encrypt, puede descargar, instalar y renovar fácilmente el certificado SSL para su dominio.

Puede instalar Certbot con el siguiente comando:

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

Una vez que el cliente de Certbot se haya instalado correctamente, ejecute el siguiente comando para instalar Let's Encrypt SSL para su sitio web:

certbot --apache -d dokuwiki.example.com

Se le pedirá que proporcione su correo electrónico válido y acepte el término de 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 dokuwiki.example.com
Enabled Apache rewrite module
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/dokuwiki-le-ssl.conf
Enabled Apache socache_shmcb module
Enabled Apache ssl module
Deploying Certificate to VirtualHost /etc/apache2/sites-available/dokuwiki-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/dokuwiki-le-ssl.conf

A continuación, seleccione si desea o no redirigir el tráfico HTTP a HTTPS o configurar Nginx para redirigir todo el tráfico al acceso HTTPS seguro, como se muestra en el siguiente resultado:

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

Escriba 2 y presione Entrar para iniciar el proceso. Una vez que se complete la instalación, debería obtener el siguiente resultado:

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

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

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

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

En este punto, tu sitio Dokuwiki está protegido con Let's Encrypt SSL. Ahora puede acceder a su sitio de forma segura utilizando el protocolo HTTPS.

Configuración de la renovación automática del certificado SSL de Let's Encrypt

De forma predeterminada, los certificados de Let's Encrypt tienen una validez de 90 días. Por lo tanto, deberá configurar un trabajo cron para renovar automáticamente el certificado SSL. Es seguro crear un trabajo cron que se ejecute todas las semanas o incluso todos los días.

Si desea renovar el certificado SSL manualmente, ejecute el siguiente comando:

certbot renew --dry-run

Puede configurar un trabajo cron para renovar automáticamente el certificado SSL todos los días a las 10:00 am editando el siguiente archivo:

crontab -e

Agregue la siguiente línea:

00 10 * * *   root /usr/bin/certbot renew >/dev/null 2>&1

Guarde y cierre el archivo cuando haya terminado.

Acceder a DokuWiki

Ahora, abra su navegador web y escriba la URL https://dokuwiki.example.com/install.php . Debería ver la pantalla de instalación de DokuWiki:

Proporcione su nombre de wiki, nombre de usuario de administrador, contraseña, correo electrónico, elija su política y haga clic en Guardar botón. Será redirigido a la siguiente página:

Haz clic en "tu nuevo DokuWiki ". Debería ver la siguiente pantalla:

Haga clic en Iniciar sesión botón. Será redirigido a la pantalla de inicio de sesión de DokuWiki como se muestra a continuación:

Proporcione su nombre de usuario y contraseña de administrador y haga clic en Iniciar sesión botón. Deberías ver el panel de DokuWiki en la siguiente pantalla:

Conclusión

¡Felicidades! Ha instalado correctamente DokuWiki y lo ha asegurado con Let's Encrypt SSL en Debian 11. Ahora puede comenzar a crear su primer sitio web con DokuWiki. Siéntase libre de preguntarme si tiene alguna pregunta.


Debian
  1. Asegure Apache con Lets Encrypt en Debian 10

  2. Cómo instalar Tiki Wiki con Apache y Lets encrypt SSL en Debian 10

  3. Cómo instalar Automad CMS con Apache y Lets encrypt en Debian 10

  4. Cómo instalar ElkArte Forum con Apache y Lets Encrypt en Debian 10

  5. Cómo instalar Let's Encrypt SSL con Apache en Debian 11

Cómo instalar Lighttpd con PHP, MariaDB y Lets Encrypt SSL en Debian 10

Cómo instalar Wekan Kanban con Nginx y Lets Encrypt SSL en Debian 10

Cómo instalar WordPress con Apache y Let's Encrypt SSL en Debian 11

Cómo instalar Let's Encrypt SSL en Apache en Debian 11

Cómo instalar y configurar Apache con Let's Encrypt TLS/SSL en Debian 11 Bullseye

Cómo instalar Let's Encrypt SSL en Ubuntu con Apache