Search code examples
dockernginxsslnopcommercecertbot

Getting SSL working with nopCommerce on Docker


My current setup is an Ubuntu VM with a docker running the nopCommerce container with 80:80 port binding. I want to install an ssl certificate, preferably with certbot, and get everything working. My questions are:

  1. Do I install certificate on VM or into docker image?
  2. Do I need nginx or similar software, if so, should I use another docker image or install directly?
  3. If I do need it, how should I configure it?
  4. Exposing port 80 directly does seem like the wrong approach, what would be a correct one?

I found this guide, but it assumes the ssl is already installed and does not mention docker at all so I assume it is for directly installed one: https://www.nop-templates.com/how-to-enable-ssl-for-your-nopcommerce-store.

Also this forum post seems to be relevant: https://www.nopcommerce.com/en/boards/topic/81536/how-to-set-up-ssl-on-the-official-docker-image


Solution

  • If you use kestrel (which has to be in your case) then you can add env parameters and expose 443 after setting it from admin panel.

    You can also use self-signed ssl if you're in development enviroment.

    EXPOSE 443
    ENV ASPNETCORE_Kestrel__Certificates__Default__Password=
    ENV ASPNETCORE_Kestrel__Certificates__Default__Path=