This guide is to help people deploy Umbraco to production. This guide is not aimed at Umbraco Cloud users, if you want to work with Umbraco Cloud then I recommend checking out other resources and look into things like Umbraco Deploy. Instead, this guide is aimed at developers who want to host their sites in normal web hosts, or Azure. In this guide. you will learn how an Umbraco website is structured. You will learn about what files you will need to copy and how you can manage configuration for different environments.
When I start to think about migrating my code onto production, my first task is to perform a Visual Studio to publish into a folder on my local PC and then inspect if all the files required to run a production site get transferred across. You will save a bunch of time debugging deployment bugs locally, compared to debugging a similar problem on production. To do this, simply make sure you in
Release mode and do a folder publish.
In my workflow, I will hook my site up in my local IIS in order to help me test everything that is working. If you prefer you could publish and use docker to host your site, however, I find IIS easier mainly as I've had more experience with it over the last 20 years.
When it comes to your files, these are the key things you need to make sure get copied across:
- Google Analytics If you use Google Analytics, make sure the tracking code is correct
Debug = false Seems like the most obvious thing in the world, but I still stumble upon sites with compilation debug set to true in production environments Force WWW To keep consistent URLs on my site, I like to force my website to be visited with the WWW prefix. One way to ensure this is using a simple URL rewrite rule Verify all paths Search for ":" and "\" in all config files and check that all paths are correct Verify appsettings and connectionstring make sure they have the correct values for production environment Encrypt connectionstrings Don't keep connectionstrings in plaintext in the demilitarized zone. [Separate the connectionstring section] (http://stackoverflow.com/questions/6582970/separate-connectionstrings-and-mailsettings-from-web-config-possible) and encrypt it on the web server (Remember: You cannot encrypt the file on one server and transfer it to another. You must copy the file in plaintext and do the encryption on each server) Security headers