Shopware 6 is a powerful and flexible e-commerce platform used for building online stores. In this guide, we will walk you through the steps to install Shopware 6 with Nginx and Let's Encrypt SSL on Ubuntu 20.04 LTS. Whether you’re using a Windows VPS UK or another VPS hosting solution, this setup will ensure your store is secure and performant.

Prerequisites

Before you begin, ensure you have the following:

Step 1: Update Your System

First, update your system packages to ensure everything is up-to-date. Run the following command:

sudo apt update && sudo apt upgrade

Step 2: Install Nginx

Next, install Nginx as the web server. Run the following command to install Nginx:

sudo apt install nginx

After installation, start and enable Nginx:

sudo systemctl start nginx
sudo systemctl enable nginx

Step 3: Install PHP and Required Extensions

Shopware 6 requires PHP and certain PHP extensions. Install PHP 7.4 (or later) and the necessary extensions with the following command:

sudo apt install php7.4-fpm php7.4-mysql php7.4-xml php7.4-curl php7.4-gd php7.4-zip php7.4-intl php7.4-mbstring php7.4-opcache

Step 4: Install MariaDB and Create a Database

Shopware 6 uses MariaDB as the database. Install MariaDB with the following command:

sudo apt install mariadb-server

After installation, secure the MariaDB installation:

sudo mysql_secure_installation

Next, log in to the MySQL shell and create a new database and user for Shopware:

sudo mysql -u root -p
CREATE DATABASE shopwaredb;
CREATE USER 'shopwareuser'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON shopwaredb.* TO 'shopwareuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Step 5: Download and Set Up Shopware 6

Now, download the latest version of Shopware 6. Navigate to the web root directory and run the following commands:

cd /var/www
wget https://www.shopware.com/en/Download/redirect/version/sw6/file/install_v6.4.0.0.zip -O shopware.zip
sudo apt install unzip
unzip shopware.zip -d shopware
sudo chown -R www-data:www-data /var/www/shopware
sudo chmod -R 755 /var/www/shopware

Step 6: Configure Nginx for Shopware

Create a new Nginx configuration file for Shopware:

sudo nano /etc/nginx/sites-available/shopware

Add the following configuration, replacing your-domain.com with your actual domain name:

server {
    listen 80;
    server_name your-domain.com;
    root /var/www/shopware/public;

    index index.php index.html index.htm;

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

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
    }

    location ~ /\.ht {
        deny all;
    }
}

Save and close the file. Then, enable the site and restart Nginx:

sudo ln -s /etc/nginx/sites-available/shopware /etc/nginx/sites-enabled/
sudo systemctl restart nginx

Step 7: Install Let's Encrypt SSL

To secure your Shopware store with SSL, use Let's Encrypt. First, install Certbot, the tool used to generate Let's Encrypt certificates:

sudo apt install certbot python3-certbot-nginx

Next, generate an SSL certificate for your domain:

sudo certbot --nginx -d your-domain.com

Follow the prompts to complete the SSL installation. Certbot will automatically configure Nginx to use SSL. After the setup is complete, you can verify SSL by visiting https://your-domain.com.

Step 8: Complete the Shopware Installation

Now, open your browser and navigate to https://your-domain.com to complete the Shopware installation. You will be guided through a web-based installation wizard where you'll need to input your database information and configure your store settings.

Conclusion

By following these steps, you have successfully installed and configured Shopware 6 with Nginx and Let's Encrypt SSL on Ubuntu 20.04. This setup provides a secure and optimized environment for your online store. Whether you're using a Windows VPS UK or another Windows Virtual Dedicated Server Hosting solution, Shopware 6 is a powerful tool for growing your e-commerce business.

War diese Antwort hilfreich? 0 Benutzer fanden dies hilfreich (0 Stimmen)