GNU/Linux >> Tutoriales Linux >  >> Ubuntu

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

Shopware CE es una plataforma de comercio electrónico gratuita y de código abierto escrita en Symfony y Vue.js. Se basa en una pila de tecnología bastante moderna y es una muy buena alternativa a otra aplicación de comercio electrónico, como Magento. Es una aplicación muy poderosa y flexible y le brinda la libertad de aprovechar rápida y fácilmente su potencial de crecimiento y enfocarse en la experiencia perfecta del cliente. Proporciona una interfaz de administración simple y fácil de usar para administrar clientes y pedidos. Le permite administrar los precios de los productos, cambiar o actualizar temas, diseñar plantillas de correo electrónico para comercializar sus productos y generar resultados estadísticos.

En este tutorial, le mostraremos cómo instalar Shopware CE con Nginx y Let's Encrypt en Ubuntu 20.04.

Requisitos

  • Un servidor con Ubuntu 20.04 con un mínimo de 4 GB de RAM.
  • Un nombre de dominio válido apuntado con su servidor.
  • Se ha configurado una contraseña raíz en su servidor.

Instalar Nginx y MariaDB

Primero, instale el servidor web Nginx y el servidor de base de datos MariaDB usando el siguiente comando:

apt-get install nginx mariadb-server -y

Una vez que ambos paquetes estén instalados, inicie el servicio Nginx y MariaDB, y habilítelos para que se inicien en el arranque del sistema:

systemctl start nginx
systemctl start mariadb
systemctl enable nginx
systemctl enable mariadb

Instalar PHP y otros componentes

Shopware 6 admite versiones de PHP entre 7.2 y 7.3. Por lo tanto, deberá instalar PHP junto con otras bibliotecas en su sistema.

Primero, agregue el repositorio de PHP en su sistema con el siguiente comando:

apt-get install software-properties-common -y
add-apt-repository ppa:ondrej/php

Una vez que se agrega el repositorio, instale PHP con otras bibliotecas usando el siguiente comando:

apt-get install php7.2 php7.2-cli php7.2-fpm php7.2-common php7.2-mysql php7.2-curl php7.2-json php7.2-zip php7.2-gd php7.2-xml php7.2-mbstring php7.2-intl php7.2-opcache git unzip socat curl bash-completion -y

Una vez que todos los paquetes estén instalados, edite el archivo php.ini y modifique algunas configuraciones deseadas:

nano /etc/php/7.2/fpm/php.ini

Cambie las siguientes líneas:

memory_limit = 512M
upload_max_filesize = 20M
max_execution_time = 300

Guarde y cierre el archivo cuando haya terminado.

A continuación, deberá instalar el cargador IonCube en su sistema.

Primero, descárgalo con el siguiente comando:

wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz

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

tar xfz ioncube_loaders_lin_x86-64.tar.gz

A continuación, busque la ruta del directorio de la extensión de PHP:

php -i | grep extension_dir

Debería ver el siguiente resultado:

extension_dir => /usr/lib/php/20190902 => /usr/lib/php/20190902

A continuación, copie el cargador IonCube en el directorio de extensiones de PHP:

cp ioncube/ioncube_loader_lin_7.2.so /usr/lib/php/20180731/

A continuación, edite el archivo php.ini y defina el cargador IonCube:

nano /etc/php/7.2/fpm/php.ini

Agregue la siguiente línea dentro de la sección [PHP]:

zend_extension = /usr/lib/php/20180731/ioncube_loader_lin_7.2.so

Guarde y cierre el archivo y luego reinicie el servicio PHP-FPM para aplicar los cambios.

systemctl restart php7.2-fpm

Configurar base de datos MariaDB

Primero, asegure la instalación de MariaDB y configure la contraseña de root usando 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

Una vez que haya terminado, 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 luego cree una base de datos y un usuario para Shopware:

MariaDB [(none)]> CREATE DATABASE shopwaredb;
MariaDB [(none)]> GRANT ALL ON shopwaredb.* TO 'shopware'@'localhost' IDENTIFIED BY 'password';

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 compositor

Composer es un administrador de dependencias para PHP. Se utiliza para instalar todas las dependencias de PHP necesarias para instalar Shopware.

Puede instalarlo usando el comando curl como se muestra a continuación:

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

Una vez instalado, verifique la versión de Composer con el siguiente comando:

composer --version

Deberías obtener el siguiente resultado:

Composer version 1.10.7 2020-06-03 10:03:56

Descargar Shopware

Primero, cree un directorio para Shopware dentro del directorio raíz web de Nginx:

mkdir /var/www/html/shopware

Luego, cambie el directorio a shopware y descargue la última versión de Shopware usando el siguiente comando:

cd /var/www/html/shopware
wget https://www.shopware.com/en/Download/redirect/version/sw6/file/install_6.2.2_1592398977.zip

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

unzip install_6.2.2_1592398977.zip

Luego, instale todas las dependencias de PHP usando el siguiente comando:

composer install

A continuación, cambie la propiedad del directorio de la tienda y otorgue los permisos adecuados con el siguiente comando:

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

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

Configurar Nginx para Shopware

Primero, cree un nuevo archivo de configuración de host virtual Nginx para Shopware:

nano /etc/nginx/sites-available/shopware.conf

Agregue las siguientes líneas:

server {
    listen 80;

    index index.php index.html;
    server_name shopware.linuxbuz.com;
    root /var/www/html/shopware/public;

    location /recovery/install {
        index index.php;
        try_files $uri /recovery/install/index.php$is_args$args;
    }

    location /recovery/update/ {
        location /recovery/update/assets {
        }
        if (!-e $request_filename){
            rewrite . /recovery/update/index.php last;
        }
    }

    location / {
        try_files $uri /index.php$is_args$args;
    }

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        include fastcgi.conf;
        fastcgi_param HTTP_PROXY "";
        fastcgi_buffers 8 16k;
        fastcgi_buffer_size 32k;
        client_max_body_size 24M;
        client_body_buffer_size 128k;
        fastcgi_pass unix:/run/php/php7.2-fpm.sock;
        http2_push_preload on;
    }
}

Guarde y cierre el archivo, luego habilite el archivo de host virtual de Shopware con el siguiente comando:

ln -s /etc/nginx/sites-available/shopware.conf /etc/nginx/sites-enabled/

A continuación, compruebe si hay algún error de sintaxis en Nginx con el siguiente comando:

nginx -t

Deberías obtener el siguiente resultado:

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

A continuación, reinicie el servicio Nginx para aplicar los cambios:

systemctl reload nginx

Acceso al asistente de instalación de Shopware

En este punto, Shopware está instalado en su sistema. Ahora, abra su navegador web y escriba la URL http://shopware.linuxbuz.com. Debería ver el asistente de instalación web de Shopware:

Seleccione su idioma y haga clic en Siguiente botón. Debería ver la siguiente pantalla:

Asegúrese de que todas las dependencias requeridas estén instaladas y luego haga clic en Siguiente botón. Debería ver la siguiente pantalla:

Acepte los términos y condiciones y haga clic en Siguiente botón. Debería ver la siguiente pantalla:

Proporcione los detalles de su base de datos y haga clic en Iniciar instalación botón. Una vez que la instalación se haya completado con éxito, debería ver la siguiente pantalla:

Ahora, haga clic en Siguiente botón. Debería ver la pantalla de configuración de Shopware:

Proporcione el nombre de su tienda, correo electrónico, país, correo electrónico del administrador, nombre de usuario del administrador, contraseña y haga clic en Siguiente botón. Se le redirigirá a la pantalla del panel de control de Shopware:

Haga clic en Siguiente botón. Debería ver la siguiente pantalla:

Instale los datos deseados y haga clic en Siguiente botón. Debería ver la siguiente pantalla:

Seleccione el agente de correo electrónico deseado y haga clic en Siguiente botón. Debería ver la siguiente pantalla:

Seleccione la opción deseada y haga clic en Siguiente botón. Debería ver la siguiente pantalla:

Configura tu PayPal o haz clic en Saltar botón. Debería ver la siguiente pantalla:

Configure sus credenciales de PayPal o haga clic en Omitir botón. Debería ver la siguiente pantalla:

Seleccione su región y haga clic en Siguiente botón. Debería ver la siguiente pantalla:

Haga clic en Omitir botón. Una vez que el Shopware esté configurado, debería ver la siguiente pantalla:

Haga clic en Finalizar botón. Debería ver el panel de Shopware en la siguiente pantalla:

Asegure Shopware con Let's Encrypt

Antes de comenzar, deberá instalar el cliente Certbot en su sistema para instalar y administrar Let's Encrypt SSL. Puedes instalarlo usando el siguiente comando:

apt-get install certbot python3-certbot-nginx -y

Una vez que el cliente de Certbot esté instalado, ejecute el siguiente comando para descargar e instalar Let's Encrypt SSL para su sitio web:

certbot --nginx -d shopware.linuxbuz.com

Proporcione su dirección de correo electrónico 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 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 shopware.linuxbuz.com
Waiting for verification...
Cleaning up challenges
Deploying Certificate to VirtualHost /etc/nginx/sites-enabled/shopware.conf

Seleccione si desea redirigir o no el tráfico HTTP a HTTPS:

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 enter para iniciar el proceso. Una vez que se complete la instalación, debería ver el siguiente resultado:

Redirecting all traffic on port 80 to ssl in /etc/nginx/sites-enabled/shopware.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://shopware.linuxbuz.com

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

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/shopware.linuxbuz.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/shopware.linuxbuz.com/privkey.pem
   Your cert will expire on 2020-09-22. 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, su sitio web de Shopware está protegido con Let's Encrypt SSL. Ahora puede acceder a su sitio web de forma segura utilizando la URL https://shopware.linuxbuz.com.

Conclusión

¡Felicidades! ha instalado con éxito Shopware con Nginx y Let's Encrypt SSL en Ubuntu 20.04. Ahora puede comenzar a configurar su propio negocio en línea usando Shopware. Siéntase libre de preguntarme si tiene alguna pregunta.


Ubuntu
  1. Cómo instalar Nextcloud con Nginx y Lets Encrypt SSL en Ubuntu 20.04 LTS

  2. Cómo instalar Magento 2 con Nginx y Lets Encrypt SSL en Ubuntu 20.04 LTS

  3. Cómo instalar Magento 2 con Nginx y Letsencrypt en Ubuntu 18.04

  4. Cómo instalar Drupal 8 con Nginx, PHP-FPM y SSL en Ubuntu 15.10

  5. Cómo instalar Shopware con NGINX y Lets encrypt en Ubuntu 18.04 LTS

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

Cómo instalar ProjectSend con Apache y Lets Encrypt SSL en Ubuntu 20.04

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

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

Cómo instalar Gitea con Nginx y Lets Encrypt SSL gratis en Ubuntu 20.04

Cómo instalar Shopware con NGINX y Lets encrypt en Debian 9