Domain name instructions

From TheInterWiki

Once your wiki is up and running and you want to make it official with a domain name and SSL certificate you will need to follow these steps

Domain name($)

You must first decide on a domain name. MyWiki.com is probably taken, so choose something unique to your facility or Physicians group. If there is an existing domain name that you are adding the wiki to, we suggest you use a sub-domain. It doesn’t cost extra to do this, you just need to add a record in the DNS settings for the existing domain name.

Example: If www.HeartPhysiciansGroup.com is the main website for the group, 
you can set wiki.HeartPhysiciansGroup.com to point to the new server.

Register a domain name

To register a new domain name, do the following:

  1. Log in to your AWS account.
  2. Go to EC2 -> Elastic IP’s.
  3. Allocate a new elastic IP.
    1. Make sure it is in the same region as your instance.
    2. There is no charge for an Elastic IP that is associated with a running instance.
    3. Once it is allocated to your account, associate it with your instance.
  4. Use the AWS search bar to find Route 53.
  5. From the Route 53 dashboard, purchase your domain name.

Point the domain name to your instance

  1. Create a new hosted zone. This is the address book for where you want incoming traffic for your domain name
  2. See Hosted Zone tutorial on AWS for a tutorial on hosted zones and records.
  3. If you are adding a sub-domain to an existing domain, ask your website administrator to create an “A” record in the DNS zone for your subdomain that points to your Elastic IP.
  4. Once this is done, you are almost there!

Add a VirtualHost file to your Apache web server

This tells Apache to send traffic for your domain name to the appropriate folder on your instance. Since the wiki files are in a sub-folder of the web directory, you have to tell Apache to forward it. This is how you can have multiple websites on the same server.

  • Open your terminal program and connect to your command line.
  • Open nano to create the file:
sudo nano /etc/apache2/sites-available/wiki.conf
  • Copy and paste the following:
<VirtualHost *:80>

ServerAdmin admin@your-domain.com
DocumentRoot /var/www/html/wiki/
ServerName your-domain.com
ServerAlias www.your-domain.com, your-domain.com, wiki.your-domain.com

<Directory /var/www/html/wiki/> 
Options FollowSymlinks 
AllowOverride All 
Require all granted 
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>
  • Change the following:
    • ServerAdmin: This should be the email for the wiki administrator. Usually the email account you set up for the AWS account.
    • ServerName: your domain name
    • Server alias: a comma-delimited list of possible combinations of domain name and sub-domains. These should all have matching “A” records in your hosted zone.
  • Use Ctrl-x to exit the editor, select y to save, hit enter to confirm the file name.
  • Next disable the default account
sudo a2dissite 000-default.conf
  • Enable the new file
sudo a2ensite joomla.conf
  • Enable the Apache forwarding modules
sudo a2enmod rewrite ssl rewrite
  • Restart Apache
sudo systemctl restart apache2

You should be able to go to your domain in the web browser and see your wiki, but you will need to access it from http, not https. That will be taken care of in the next section.

Adding SSL

SSL is the Secure Socket Layer of the World Wide Web. It is designated by https in the url for a website, and a padlock icon in the address bar. It adds a layer of encryption to web traffic, and most browsers these days will warn you before connecting to a non-encrypted website, or, refuse to connect to a non-encrypted website.

Certbot

unless you want to go through the expense and hassle of an official certificate, you can self-sign a certificate using the OpenSSL service and CertBot to encrypt your web traffic.

  • Go to The CertBot Ubuntu instructions page and follow the directions there.
    • SnapD is already installed, so start at step 3.
    • Be sure to test the automatic renewal, this will save a hassle later.

Test everything

Go to your wiki using your domain name and make sure everything works. You should be securely connecting to your server and see your wiki.