Instalación CMS · 8 min read · Sep 26, 2025

Cómo instalar CraftCMS con Apache y Let's Encrypt SSL en Ubuntu 22.04 LTS

Craft es un sistema de gestión de contenido de código abierto, flexible y rico en funciones para desarrolladores y autores de contenido. Ofrece todas las características de personalización necesarias para construir un sitio web potente. Te permite gestionar el contenido de varios sitios desde un solo panel de control. Es una solución alternativa a WordPress y Drupal para construir experiencias digitales a medida. Tiene cientos de complementos gratuitos y de pago que te permiten agregar funcionalidad.

Esta publicación explicará cómo instalar Craft CMS con Apache y Let’s Encrypt SSL en Ubuntu 22.04.

Prerequisitos

  • Un servidor que ejecute Ubuntu 22.04.
  • Nombre de dominio válido apuntado a la IP de tu servidor.
  • Una contraseña de root configurada en el servidor.

Instalar servidor LAMP

Craft CMS se ejecuta en el servidor web, está escrito en PHP y utiliza MariaDB como backend de base de datos. Por lo tanto, necesitarás instalar todos esos paquetes en tu servidor.

Puedes ejecutar el siguiente comando para instalar todos esos paquetes:

apt-get install apache2 mariadb-server php php-cli libapache2-mod-php php-common php-json php-curl php-gd php-imagick php-json php-mbstring php-mysql php-pgsql php-zip php-intl php-xml -y

Después de instalar todos los paquetes, edita el archivo de configuración de PHP y cambia la configuración predeterminada:

nano /etc/php/8.1/php.ini

Cambia las siguientes configuraciones:

memory_limit = 512M
post_max_size = 32M
upload_max_filesize = 32M
max_execution_time = 360

Guarda y cierra el archivo, luego reinicia el servicio de Apache para aplicar los cambios:

systemctl restart apache2

Crear una base de datos para CraftCMS

A continuación, necesitarás crear una base de datos y un usuario para Craft CMS. Primero, inicia sesión en el shell de MariaDB con el siguiente comando:

mysql

Una vez que hayas iniciado sesión, crea una base de datos y un usuario con el siguiente comando:

MariaDB [(none)]> CREATE DATABASE craftcms;  
MariaDB [(none)]> GRANT ALL ON craftcms.* TO 'craftuser' IDENTIFIED BY 'password';

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

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

En este punto, la base de datos de MariaDB está creada para Craft CMS. Ahora puedes proceder al siguiente paso.

Instalar Craft CMS usando Composer

A continuación, necesitarás instalar Composer para descargar la última versión de Craft CMS. Puedes instalarlo usando el siguiente comando:

curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

Una vez que Composer esté instalado, navega al directorio raíz web de Apache y crea un proyecto de Craft CMS usando el siguiente comando:

cd /var/www/html  
composer create-project craftcms/craft craftcms

Se te pedirá que proporciones la configuración de tu base de datos, nombre de usuario de administrador, contraseña, URL del sitio como se muestra a continuación:

Which database driver are you using? (mysql or pgsql) [mysql] 
Database server name or IP address: [127.0.0.1] 
Database port: [3306] 
Database username: [root] craftuser
Database password: 
Database name: craft
Database table prefix: 
Testing database credentials ... success!
Saving database credentials to your .env file ... done

Install Craft now? (yes|no) [yes]:yes

Username: [admin] admin
Email: [email protected]
Password: 
Confirm: 
Site name: CraftCMS Site
Site URL: http://craftcms.example.com
Site language: [en-US] 

    > add foreign key fk_rlbmgnhpxsljkaunjwnsezfrnrkhwzpthfsq: {{%widgets}} (userId) references {{%users}} (id) ... done (time: 0.035s)
    > populating the info table ... done
    > saving default site data ... done
    > saving the first user ... done
*** installed Craft successfully (time: 5.449s)

A continuación, establece los permisos y la propiedad adecuados en el directorio de Craft CMS:

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

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

Configurar Apache para Craft CMS

A continuación, necesitarás crear un archivo de configuración de host virtual de Apache para Craft CMS. Puedes crearlo con el siguiente comando:

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

Agrega las siguientes líneas:


     ServerAdmin [email protected]
     DocumentRoot /var/www/html/craftcms/web
     ServerName craftcms.example.com


     
          Options FollowSymlinks
          AllowOverride All
          Require all granted
     

     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined
    
     
            RewriteEngine on
            RewriteBase /
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteRule ^(.*) index.php [PT,L]
    

Guarda y cierra el archivo, luego activa el host virtual de Apache y el módulo de reescritura usando el siguiente comando:

a2ensite craftcms.conf  
a2enmod rewrite

A continuación, reinicia el servicio de Apache para aplicar los cambios:

systemctl restart apache2

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

systemctl status apache2

Obtendrás la siguiente salida:

? apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2022-06-17 15:48:11 UTC; 31min ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 37935 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
    Process: 40916 ExecReload=/usr/sbin/apachectl graceful (code=exited, status=0/SUCCESS)
   Main PID: 37939 (apache2)
      Tasks: 6 (limit: 2292)
     Memory: 53.0M
        CPU: 28.718s
     CGroup: /system.slice/apache2.service
             ??37939 /usr/sbin/apache2 -k start
             ??40920 /usr/sbin/apache2 -k start
             ??40921 /usr/sbin/apache2 -k start
             ??40922 /usr/sbin/apache2 -k start
             ??40923 /usr/sbin/apache2 -k start
             ??40924 /usr/sbin/apache2 -k start

Jun 17 15:48:11 ubuntu2204 systemd[1]: Starting The Apache HTTP Server...

Una vez que tu servidor web Apache esté configurado, puedes proceder al siguiente paso.

Acceder a la interfaz web de Craft CMS

Ahora, abre tu navegador web y escribe la URL http://craftcms.example.com para acceder a la interfaz web de Craft CMS. Deberías ver la siguiente página:

Haz clic en ir a tu panel de control. Serás redirigido a la página de inicio de sesión de Craft CMS:

Proporciona tu nombre de usuario de administrador, contraseña y haz clic en el botón iniciar sesión. Deberías ver el panel de control de Craft CMS en la siguiente página:

Asegurar Craft CMS con Let’s Encrypt SSL

A continuación, es una buena idea asegurar tu sitio web con Let’s Encrypt SSL. Primero, instala el paquete del cliente Certbot con el siguiente comando:

apt-get install python3-certbot-apache -y

Después de la instalación exitosa, ejecuta el siguiente comando para asegurar tu sitio web con Let’s Encrypt SSL:

certbot --apache -d craftcms.example.com

Se te pedirá que proporciones tu correo electrónico y aceptes los términos del servicio como se muestra a continuación:

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): [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
Plugins selected: Authenticator apache, Installer apache
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for craftcms.example.com
Enabled Apache rewrite module
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/craftcms-le-ssl.conf
Enabled Apache socache_shmcb module
Enabled Apache ssl module
Deploying Certificate to VirtualHost /etc/apache2/sites-available/craftcms-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/craftcms-le-ssl.conf

A continuación, selecciona si deseas o no redirigir el tráfico HTTP a HTTPS 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 presiona Enter para instalar el SSL de Let’s Encrypt para tu sitio web:

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

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

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

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

Conclusión

¡Felicidades! has instalado con éxito Craft CMS con Apache y Let’s Encrypt SSL en Ubuntu 22.04. Ahora puedes explorar las características de CraftCMS y comenzar a crear un sitio web potente utilizando Craft CMS. No dudes en preguntarme si tienes alguna pregunta.

Share: X/Twitter LinkedIn

Recibe nuevas publicaciones en tu bandeja de entrada.

No spam. Cancela la suscripción en cualquier momento.