Linux MySQL

Install nopCommerce on Ubuntu 20.04, MySQL, Nginx, SSL

Disclosure: This post may contain affiliate links, which means we may receive a commission if you click a link and purchase something that we recommended.

Pinterest LinkedIn Tumblr

nopCommerce is a free open-source e-commerce web application built with ASP.NET. It is a high performance application with multi-store, multi-vendor and a user-friendly web interface.

In this guide you are going to learn how to install nopCommerce in Ubuntu 20.04 with MySQL, Nginx and secure the setup with Let’sEncrypt SSL.


  • A Ubuntu 20.04 server and user with sudo privileges.

1. Initial setup

Update all packages to the latest version available.

sudo apt update
sudo apt dist-upgrade -y

Install unzip package to extract nopCommerce source code.

sudo apt install unzip

2. Install MySQL

Install MySQL server for your database. We will install MySQL 8.

sudo apt install mysql-server mysql-client

Secure MySQL server.

sudo mysql_secure_installation

Follow the prompts one by one and setup new password for your root user.

Login to MySQL.

sudo mysql -u root -p

Enter the password you have configured earlier to login.

3. Create Database for nopCommerce

Create a new database and user for the nopCommerce application.

CREATE DATABASE nopcommerce_db /*\!40100 DEFAULT CHARACTER SET utf8mb4 */;

Create new user.

CREATE USER 'nopcommerce_user'@'localhost' IDENTIFIED BY 'secure_password';
GRANT ALL PRIVILEGES ON nopcommerce_db.* TO 'nopcommerce_user'@'localhost';

Now you have MySQL installed and have new database with user.

4. Install ASP.NET

Download Microsoft package signing key and add it you the package repository.

Execute the following commands.

sudo wget -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo rm packages-microsoft-prod.deb

Install ASP.NET runtime.

sudo apt update
sudo apt install apt-transport-https
sudo apt install aspnetcore-runtime-6.0

Verify the installation.

dotnet --list-runtimes

Microsoft.AspNetCore.App 6.0.3 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.3 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

5. Install Nginx

Now we will install Nginx and configure it.

sudo apt install nginx

Once the installation is complete, we will delete the default server blocks and configure a new one for nopCommerce.

sudo rm -rf /etc/nginx/sites-available/default
sudo rm -rf /etc/nginx/sites-enabled/default

Configure Nginx for nopCommerce.

Create a new configuration file.

sudo nano /etc/nginx/sites-available/nopcommerce.conf

Paste the following to the file. We are using a proxy configuration to port 5000 on which nopCommerce runs.

server {
    listen 80;
    listen [::]:80;


    location / {
        proxy_pass         http://localhost:5000;
        proxy_http_version 1.1;
        proxy_set_header   Upgrade $http_upgrade;
        proxy_set_header   Connection keep-alive;
        proxy_set_header   Host $host;
        proxy_cache_bypass $http_upgrade;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Proto $scheme;

Hit CTRL+X followed by Y and ENTER to save and exit the file.

Enable the configuration by creating a symlink to sites-enabled directory.

sudo ln -s /etc/nginx/sites-available/nopcommerce.conf /etc/nginx/sites-enabled/nopcommerce.conf

Restart Nginx for the configuration to take effect.

sudo service nginx restart

6. Install nopCommerce

Navigate to your favorite directory to download latest nopCommerce source code for Linux from their official Git repository.

cd /var/www/html
sudo wget

Extract the downloaded file.

sudo unzip

Remove the zip file.

sudo rm -rf

Configure permissions.

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

7. Configure nopCommerce as a Service

Configure nopCommerce as a service so that it runs as a system service. It will be easier to manage.

Create a new service file.

sudo nano /etc/systemd/system/nopcommerce.service

Paste the following contents.

Description=NopCommerce eCommerce application

ExecStart=/usr/bin/dotnet /var/www/html/Nop.Web.dll

# Auto restart nopCommerce in 10 seconds if .NET crashes


Restart system daemon.

sudo systemctl daemon-reload

Enable nopCommerce to start at system boot.

sudo systemctl enable nopcommerce

Start nopCommerce.

sudo systemctl start nopcommerce

Check status using the following command.

sudo systemctl status nopcommerce
● nopcommerce.service - NopCommerce Ecommerce Application
     Loaded: loaded (/etc/systemd/system/nopcommerce.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2022-04-06 06:22:05 UTC; 2min 36s ago
   Main PID: 5149 (dotnet)
      Tasks: 20 (limit: 1151)
     Memory: 449.6M
     CGroup: /system.slice/nopcommerce.service
             └─5149 /usr/bin/dotnet /var/www/html/Nop.Web.dll

Now you have nopCommerce, MySQL, Nginx running.

8. Install Let’sEncrypt SSL

We can use Certbot to install free Let’s Encrypt SSL certificate for your domain.

sudo apt install python3-certbot-nginx

Execute the following command to install certificate and configure redirect to HTTPS automatically.

sudo certbot --nginx --redirect --agree-tos --no-eff-email -m [email protected] -d -d

Now you should receive SSL certificate and it will be configured automatically.

Setup auto renewal.

sudo certbot renew --dry-run

Now we have configured everything.

Check your domain on your browser, you will see the installation guide page.

Nopcommerce installation

For Server name under Database Information use localhost.

Fill all other appropriate values and click Install.

This will take some time and then your nopCommerce service will get started.

Once the installation is complete you will see your default homepage.


Now you have a successful installation of nopCommerce with ASP.NET, MySQL, Nginx, Let’sEncrypt SSL.


Now you have learned how to install nopCommerce on Ubuntu 20.04 with Nginx, MySQL and SSL.

Thanks for your time. If you face any problem or any feedback, please leave a comment below.


  1. I followed your instructions. Installation page was able to load. After clicking Install, following error message is shown:
    Setup failed: An exception was thrown while activating λ:FluentMigrator.Runner.IVersionLoader.

    What should I do?

  2. Hi Ryan, I managed to get around that by installing an older version of MySQL (8.0.25), but there are posts on the nopCommerce forums about this issue. It has to do with the latest version of MySQL (8.0.29), but I couldn’t recompile the source code to get around it, so I opted to downgrade MySQL.

Write A Comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.