Steps to make Nopcommerce 3.20 run on Linux with ssl (Ubuntu + Nginx + kestrel + MSSql).
I guess the trick is Nginx and kestrel have to run over the ssl (not only Nginx).
Link explaining how to create certificate for kestrel. http://www.philipermish.com/blog/how-to-use-ssl-with-dotnet-core-and-kestrel/
I added the json below on the top of the appsettings.json file
"Kestrel": {
"EndPoints": {
"Http": {
"Url": "https://localhost:5555"
},
},
"Certificates": {
"HTTPS": {
"Source": "Store",
"StoreLocation": "CurrentUser",
"StoreName": "My",
"Subject": "CN=localhost",
"AllowInvalid": true
}
}
}
Nginx configuration
server {
listen 80;
server_name mysite.com.br www.mysite.com.br;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name mysite.com.br www.mysite.com.br;
ssl_certificate /etc/letsencrypt/live/mysite.com.br/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/mysite.com.br/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
location / {
proxy_pass https://dotnet;
proxy_set_header Host $host;
}
}
upstream dotnet {
zone dotnet 64k;
server localhost:5555;
}
IMPORTANT:
1 - I change the table Store - field SslEnabled to True
2 - table setting, search for securitysettings.forcesslforallpages in the field Name and change to True
I changed direct in the database, cause when i was making tests, the store became unreachable many times by the browser