Cómo instalar PrestaShop con Apache y Let’s Encrypt SSL en CentOS 8
PrestaShop es un carrito de compras de código abierto escrito en PHP que se utiliza para crear y administrar su negocio en línea. Proporciona una interfaz simple y fácil de usar que lo ayuda a lanzar su tienda en línea en un tiempo mínimo. Proporciona una gran cantidad de funciones, que incluyen una interfaz fácil de usar, múltiples pasarelas de pago (PayPal, Google Checkout), diseño que responde a dispositivos móviles, soporte gratuito, análisis multilingüe, generación de informes y más.
En esta publicación, le mostraremos cómo instalar PrestaShop con Apache y un certificado Let’s Encrypt SSL gratuito en CentOS 8.
Requisitos previos
- Un servidor que ejecuta CentOS 8.
- Un nombre de dominio válido apuntado con la IP de su servidor.
- Una contraseña de root está configurada en su servidor.
Instalar servidor LAMP
Antes de comenzar, el servidor LAMP debe estar instalado en su servidor. Si no está instalado, puede instalarlo con otras extensiones PHP usando el siguiente comando:
dnf install httpd mariadb-server php php-cli php-bcmath php-mysqli php-gd php-pdo php-xmlrpc php-intl php-posix php-json php-curl php-zip unzip -y
Después de instalar todos los paquetes necesarios, edite el archivo php.ini y cambie algunas configuraciones predeterminadas:
nano /etc/php.ini
Cambia las siguientes líneas:
max_input_vars = 3000 post_max_size = 64M upload_max_filesize = 64M max_execution_time = 600 memory_limit = 256M date.timezone = Asia/Kolkata
Guarde y cierre el archivo, luego inicie el servicio Apache y MariaDB y habilítelos para que se inicien al reiniciar el sistema:
systemctl start httpd systemctl start mariadb systemctl enable httpd systemctl enable mariadb
En este punto, el servidor LAMP está instalado en su servidor.
Crear una base de datos para PrestaShop
PrestaShop utiliza una base de datos MySQL/MariaDB para almacenar sus datos. Por lo tanto, deberá crear una base de datos y suer para PrestaShop.
Primero, inicie sesión en MariaDB con el siguiente comando:
mysql
Una vez que inicie sesión, cree una base de datos y un usuario con el siguiente comando:
MariaDB [(none)]> CREATE DATABASE prestashopdb; MariaDB [(none)]> CREATE USER 'prestashopuser'@'localhost' IDENTIFIED BY 'securepassword';
A continuación, otorgue todos los privilegios a prestashopdb con el siguiente comando:
MariaDB [(none)]> GRANT ALL PRIVILEGES ON prestashopdb. * TO 'prestashopuser'@'localhost';
A continuación, elimine los privilegios y salga de MariaDB con el siguiente comando:
MariaDB [(none)]> FLUSH PRIVILEGES; MariaDB [(none)]> EXIT;
Una vez que haya terminado, puede continuar con el siguiente paso.
Instalar PrestaShop
A continuación, deberá descargar la última versión de PrestaShop desde su página de descarga oficial. Puedes descargarlo con el siguiente comando:
wget https://download.prestashop.com/download/releases/prestashop_1.7.7.3.zip
Una vez que se complete la descarga, descomprima el archivo descargado en el directorio raíz web de Apache con el siguiente comando:
unzip prestashop_1.7.7.3.zip -d /var/www/html/prestashop
A continuación, establezca la propiedad adecuada en el directorio de prestashop con el siguiente comando:
chown -R apache:apache /var/www/html/prestashop
Una vez que haya terminado, puede continuar con el siguiente paso.
Configurar Apache para PrestaShop
A continuación, deberá crear un archivo de configuración de host virtual de Apache para PrestaShop. Puedes crearlo con el siguiente comando:
nano /etc/httpd/conf.d/prestashop.conf
Agregue las siguientes líneas:
<VirtualHost *:80> ServerAdmin [email protected] ServerName prestashop.example.com DocumentRoot /var/www/html/prestashop <Directory /var/www/html/prestashop> Options +FollowSymlinks AllowOverride All Require all granted </Directory> ErrorLog /var/log/httpd/prestashop-error_log CustomLog /var/log/httpd/prestashop-access_log common </VirtualHost>
Guarde y cierre el archivo cuando haya terminado. A continuación, reinicie el servicio de Apache para aplicar los cambios:
systemctl restart httpd
A continuación, verifique el estado del servicio de Apache con el siguiente comando:
systemctl status httpd
Deberías obtener el siguiente resultado:
? httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled) Drop-In: /usr/lib/systemd/system/httpd.service.d ??php-fpm.conf Active: active (running) since Wed 2021-04-07 01:04:19 EDT; 2h 2min ago Docs: man:httpd.service(8) Main PID: 47841 (httpd) Status: "Total requests: 313; Idle/Busy workers 100/0;Requests/sec: 0.0425; Bytes served/sec: 1.2KB/sec" Tasks: 278 (limit: 12524) Memory: 35.9M CGroup: /system.slice/httpd.service ??47841 /usr/sbin/httpd -DFOREGROUND ??47843 /usr/sbin/httpd -DFOREGROUND ??47844 /usr/sbin/httpd -DFOREGROUND ??47845 /usr/sbin/httpd -DFOREGROUND ??47846 /usr/sbin/httpd -DFOREGROUND ??48061 /usr/sbin/httpd -DFOREGROUND Apr 07 01:04:19 centos8 systemd[1]: Stopped The Apache HTTP Server. Apr 07 01:04:19 centos8 systemd[1]: Starting The Apache HTTP Server...
Una vez que haya terminado, puede continuar con el siguiente paso.
Configurar cortafuegos
A continuación, deberá permitir los puertos 80 y 443 a través del firewall. Puede permitirlos con el siguiente comando:
firewall-cmd --zone=public --permanent --add-service=http firewall-cmd --zone=public --permanent --add-service=https
A continuación, vuelva a cargar el cortafuegos para aplicar los cambios:Publicidad
firewall-cmd --reload
Una vez que haya terminado, puede continuar con el siguiente paso.
Acceder a PrestaShop
Ahora, abra su navegador web y acceda a la interfaz web de PrestaShop usando la URL http://prestashop.ejemplo.com. Será redirigido a la siguiente página:
Seleccione su idioma y haga clic en el próximo botón. Deberías ver la siguiente página:
Acepte el acuerdo de licencia y haga clic en el próximo botón. Deberías ver la siguiente página:
Proporcione el nombre de su tienda, la información del país, la información de la cuenta y haga clic en el próximo botón. Deberías ver la siguiente página:
Proporcione el nombre de su base de datos, el nombre de usuario de la base de datos, la contraseña y haga clic en el próximo botón. Una vez finalizada la instalación, debería ver la siguiente página:
Haga clic en el Administra tu tienda botón. Deberías ver la siguiente página:
Ahora, elimine la carpeta de instalación con el siguiente comando:
rm -rf /var/www/html/prestashop/install
A continuación, haga clic en el URL de administración de PrestaShop. Deberías ver la siguiente página:
Proporcione su nombre de usuario y contraseña de administrador y haga clic en el INICIAR SESIÓN botón. Debería ver el panel de control de PrestaShop en la siguiente página:
Asegure PrestaShop con Let’s Encrypt SSL
A continuación, deberá instalar el cliente Certbot para instalar Let’s Encrypt SSL para PrestaShop. Puedes instalarlo con el siguiente comando:
dnf install letsencrypt python3-certbot-apache
A continuación, obtenga e instale un certificado SSL para su dominio de Lets con el siguiente comando:
certbot --apache -d prestashop.example.com
Se le pedirá que proporcione su dirección de correo electrónico y acepte el término del servicio:
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. Do you agree? - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (Y)es/(N)o: Y - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Would you be willing, once your first certificate is successfully issued, 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 Account registered. Requesting a certificate for prestashop.example.com Performing the following challenges: http-01 challenge for prestashop.example.com Waiting for verification. Cleaning up challenges Deploying Certificate to VirtualHost /etc/httpd/conf.d/prestashop.conf Redirecting all traffic on port 80 to ssl in /etc/httpd/conf.d/prestashop.conf - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Congratulations! You have successfully enabled https://prestashop.example.com - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Subscribe to the EFF mailing list (email: [email protected]). IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at: /etc/letsencrypt/live/prestashop.example.com/fullchain.pem Your key file has been saved at: /etc/letsencrypt/live/prestashop.example.com/privkey.pem Your certificate will expire on 2021-06-09. 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
Ahora puede acceder a su sitio web de forma segura utilizando la URL https://prestashop.ejemplo.com.
Conclusión
¡Felicidades! ha instalado con éxito PrestaShop con Apache y Let’s Encrypt SSL en CentOS 8. Ahora puede agregar su producto a PrestaShop y comenzar a vender en línea. No dude en preguntarme si tiene alguna pregunta.