Skip to content

Working with Umbraco in Web Containers

Deploying a Umbraco web application is super easy with the .NET Core + SDK Container images. We designed these to concentrate and simplify your application configuration in a single Container. This document follows a similar flow to the article on deploying .NET Core Containers.

This guide will take you through the process of setting up a .NET Core + SDK Web Container and then customizing it to run a website based on the Umbraco CMS. You can follow these steps in your local environment, or use SSH access to follow them on the Webslice Containers.

Create and Build Your App

Install Umbraco on your local machine:

dotnet new -i Umbraco.Templates

Create a new project:

dotnet new umbraco –name MyProject

Before deploying your app on your Container, there are three tweaks to make.

  1. Edit the launchSettings.json file in order to allow your project to listen on port 80.
    nano Properties/launchSettings.json
  2. Update the applicationUrl key under iisSettings group, so it looks like the following example.
    "applicationUrl": "http://localhost",
  3. Remove the value on the applicationUrl key under the Umbraco.Web.UI group.
    "applicationUrl": "",

You’re now ready to publish the project. Update the project folder name and location in this example:

dotnet publish -c release --no-restore /{project_folder}/MyProject/ -o /{desired_location}/

Deploy Your Project

Now you can move the output of the publish command to the application directory, which should be in the /container/application/ folder.

Once that’s updated, you need to make a small change to the supervisord.conf file (which is located in `/container/config). Replace the name of the dll file with the one you choose when creating the project:

[program:dotnetapp]
directory=/container/application/
;command=/usr/bin/dotnet ExampleApp.dll
command=/usr/bin/dotnet MyProject.dll
stdout_logfile=/container/logs/supervisor/%(program_name)s-stdout.log
stderr_logfile=/container/logs/supervisor/%(program_name)s-stderr.log

As with all configuration changes, you’ll need to reboot the Container for this to take effect.

Redirect to HTTPS

Most of the work that needs to be done is already covered by our SSL documentation, under the heading “How to Enforce HTTPS on a Web Container“. All of the method calls will need to be made before app.UseUmbraco(). There are a couple of other Umbraco-specific changes to make.

We’ll need to edit the applicationUrl for iisSettings to use https:// instead of http://.

"applicationUrl": "https://localhost",

The only other change you’ll need is to tell Umbraco to use HTTPS in appSettings.json. This will change all of Umbraco’s URLs to use HTTPS instead of HTTP.

"Umbraco": {
"CMS": {
"Global": {
"UseHttps": true,
}
}
}

Example Project

On GitHub you can find our example Umbraco repo. You can use this as a guide to creating your own project, or as a template.