Tech:Custom domains

This page is a how-to for setting up custom domains for wikis in nginx. This tutorial requires that you are able to edit the ansible-playbook (or able to edit your fork of it and push a pull request to master) and DNS access to the custom domain (the wiki owner should be able to do this, Orain won't manage custom domains). Please know that this is serious business, read this careful before doing any changes.

Process

 * 1) Identify the wiki which domain want to be changed. You only need it's DBname; look at Database list and find your dbname.
 * 2) Custom domains pointing to wikis can be set up in many ways. Like wiki.someproject.org, but also just someproject.org(/wiki). This is very important ;
 * 3) The DNS records needs to be changed. (Orain won't and can't buy a domain for you; you have to buy one manually.) A records or CNAME will be added/changed here. The value for the A/CNAME record will be "@" (root domain) or "[subdomain]" (like "wiki" for wiki.someproject.org), the CNAME should point to   (recommended) or for A records,   (IP can be changed, be careful!);
 * 4) If the wiki owner wants the www-form to work as well, a CNAME record should point to the A/CNAME record;
 * 5) Okay, DNS is set up, but the domain doesn't work yet because MediaWiki still serves the wiki to [a string].orain.org. Now we need to change the MediaWiki and nginx settings;
 * 6) You need a GitHub account to edit nginx/MediaWiki settings. In LocalSettings.php, the variables you need to fix are $wgCentralAuthAutoLoginWikis, $wgServer and $wgUrlShortenerDomainsWhitelist - you can look at the already present entries in these variables so you know how to correctly add the domain name. Make sure to sort it in alphabetical order. Done? commit the file (on web, just save the file - GitHub will commit for you.), and open the nginx sites-enabled file. Search for Line 15, and add the custom domain there (again, alphabetical order!) (if the DNS allows use of the www-form, add it here also, but be sure you create two separate (one with the www-suffix and one without) entries!) and commit the file;
 * 7) You are not done yet, though the biggest part is done now. Please check all your changes (you can use this pull request to verify the used syntax), and make a pull request including these changes to master. Are the edits now in the ansible-playbook? Verify the wiki works as expected. If not, revert your changes from pull request page immediately and fix the problem that causes problems;