How to Install nopCommerce on Ubuntu 20.04

Updated on February 8, 2022
How to Install nopCommerce on Ubuntu 20.04 header image


nopCommerce is a free open source eCommerce application based on the ASP.NET framework. It is secure and fully customizable, making it an excellent choice for store owners because multiple customization tools are available for designing a user-friendly online shopping website.

In this guide, you will install nopCommerce on a Ubuntu 20.04 server running Nginx, MySQL as the web, and database server software, respectively.


Step 1: Create a New nopCommerce Database

Login to MySQL.

$ mysql -u root -p

Create a new database.

mysql> create database nopcommerce; 

Create a database user with a strong password.

mysql> CREATE USER 'admin'@'localhost' IDENTIFIED BY 'password';

Refresh MySQL Privileges.


Exit the console.

Step 2: Install ASP.NET Core

For nopCommerce it to run on, you need to install .NET (dot net) Core. But first, add the Microsoft package signing key to your server and install the necessary dependencies.

Download the Ubuntu 20.04 Microsoft Package Key.

$ wget

Install it on the server.

$ sudo dpkg -i packages-microsoft-prod.deb

Then, update the server.

$ sudo apt update

Install aptitude transport for HTTPS downloads.

$ sudo apt install apt-transport-https

Now, Install .NET Core runtime.

$ sudo apt install aspnetcore-runtime-5.0

Verify the installation.

$ dotnet --list-runtimes


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

Step 3: Install nopCommerce

Create the nopCommerce webroot directory. Replace with your subdomain or preferred naming style.

$ sudo mkdir /var/www/

Now, switch to the directory.

$ cd /var/www/

Then, download the latest nopCommerce stable release from its GitHub repository. In this guide, release-4.40.4 is installed. Consider downloading the latest file.

$ sudo wget

Extract files from the Zip archive.

$ sudo unzip

To save space, delete the original zip archive.

$ rm

Grant Nginx (running as www-data) ownership permissions to the directory.

$ sudo chown -R www-data:www-data /var/www/

All necessary files are now available on the server. Next, configure Nginx as a reverse proxy to serve these files on your subdomain.

Step 4: Configure Nginx

Create a new Nginx virtual host file.

$ sudo touch /etc/nginx/sites-available/

Open and edit the file.

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

Paste the following contents:

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

    root /var/www/html;

    location / {

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;

Save and close the file.

Test Nginx for errors.

$ sudo nginx -t

Restart Nginx.

$ sudo service nginx restart

Step 5: Configure nopCommerce as a Service

To start nopCommerce, it must be running as a service on the server. To do this, create a new service file in the systemd directory.

Open and edit the file.

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

Paste the following contents:

Description=NopCommerce eCommerce application

ExecStart=/usr/bin/dotnet /var/www/

# Auto restart nopCommerce in 10 seconds if .NET crashes



Now, restart the systemd daemon.

$ sudo systemctl daemon-reload

Then, enable nopCommerce to start at boot time.

$ sudo systemctl enable nopcommerce

Start nopCommerce.

$ sudo systemctl start nopcommerce

Check the current nopCommerce status.

$ sudo systemctl status nopcommerce

Restart Nginx to start serving nopCommerce on the subdomain.

$ sudo systemctl restart nginx

Finally, visit your subdomain to start the nopCommerce setup process through a web browser.

Enter the administrator email, username, password, and country. Then, select MySQL from the drop-down list of options in the database section.

Under Server name, enter localhost, then enter the database name, username, and password created on step 1.

nopCommerce setup page

Click Install to proceed, nopCommerce will restart, and you may receive a 502 bad gateway error. Simply refresh your browser to log in and configure your online store.

Step 6: Secure the Server

By default, Uncomplicated Firewall (ufw) is enabled on Ubuntu 20.04, configure it to allow HTTP, HTTPS traffic on the server and block the rest.

Allow HTTP traffic.

$ sudo ufw allow 80/tcp

Allow HTTPS traffic.

$ sudo ufw allow 443/tcp

Restart the firewall

$ sudo ufw reload

Request an SSL Certificate

Install Certbot.

$ sudo apt install certbot python3-certbot-nginx

Request for a free Let’s Encrypt SSL certificate. Replace with your actual subdomain.

$ sudo certbot --nginx -d -d

Now, set up a new Cron job to automatically renew the SSL certificate before every 30 days of expiry.

Open the crontab file.

$ sudo crontab -e

Paste the following code:

0 12 * * * /usr/bin/certbot renew --quiet

Save and close the file.


Congratulations, you have installed nopCommerce on a Ubuntu 20.04 server. You can further configure to meet your customer and visitor standards using ready-made themes, plugins, and language packs.