wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.debsudo dpkg -i packages-microsoft-prod.debsudo apt-get updatesudo apt-get install -y apt-transport-https aspnetcore-runtime-7.0dotnet --list-runtimessudo apt-get install mysql-serversudo /usr/bin/mysql_secure_installationsudo apt-get install nginxsudo systemctl start nginxsudo systemctl status nginxTo configure nginx as a reverse proxy to forward requests to your ASP.NET Core app, modify /etc/nginx/sites-available/default. Open it in a text editor and replace the contents with the following:
# Default server configuration
#
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name nopCommerce.com;
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;
}
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
}mkdir /var/www/nopCommercecd /var/www/nopCommercesudo wget https://github.com/nopSolutions/nopCommerce/releases/download/release-4.60.1/nopCommerce_4.60.1_NoSource_linux_x64.zipsudo apt-get install unzipsudo unzip nopCommerce_4.60.1_NoSource_linux_x64.zipsudo mkdir binsudo mkdir logscd ..sudo chgrp -R www-data nopCommerce/sudo chown -R www-data nopCommerce/Create the /etc/systemd/system/nopCommerce.service file with the following contents:
[Unit]
Description=Example nopCommerce app running on Xubuntu
[Service]
WorkingDirectory=/var/www/nopCommerce
ExecStart=/usr/bin/dotnet /var/www/nopCommerce/Nop.Web.dll
Restart=always
# Restart service after 10 seconds if the dotnet service crashes:
RestartSec=10
KillSignal=SIGINT
SyslogIdentifier=nopCommerce-example
User=www-data
Environment=ASPNETCORE_ENVIRONMENT=Production
Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false
[Install]
WantedBy=multi-user.targetsudo systemctl start nopCommerce.servicesudo systemctl status nopCommerce.servicesudo systemctl restart nginxIf you have a problem with loading images in the RichText Box (The type initializer for 'Gdip' threw an exception), just install the libgdiplus library:
sudo apt-get install libgdiplus