Skip to content
Stefano Balietti edited this page Apr 11, 2020 · 2 revisions

SSL (https://)

It is recommended that you run all your Internet experiments using the https protocol for extra security. Here are the steps you need to enable it.

Get an SSL Certificate

  1. First you need an SSL certificate. You have two options:

    • You can generate one yourself following these instructions. However, self-signed certificates should be used only for testing and not in production. In fact, they will generate warnings or errors in most modern browsers connecting to the server over the Internet.

    • You can get one from a trusted source. This article reviews some free and paid-for solutions. For instance, Let's Encrypt is a good free option.

  2. Notice that some SSL providers require that you have a domain name (for example: mydomain.com) to issue the certificate. In you don't have one, you will need to buy it. See this article for an introductory guide and a list of domain registrars.

  3. In the end, you will get two files: a certificate and a key. What to do with them depends on how you decide to handle HTTPS connections. You can let nodeGame handle them directly without installing additional software. Alternatively, you can install Nginx, an open source web server known for its efficiency and robustness. If you have admin rights to install Nginx, this is the recommended choice. Both options are explained below.

nodeGame Handling HTTPS

  1. Store the certificate and the key files inside the nodegame-server folder node_modules/nodegame-server/ssl/. The files must be named: certificate.pem and private.key.

  2. Then you can start the server with the ssl option:

    node launcher --ssl

  3. Additional SSL options are available. See them typing:

    node launcher --help.

Nginx Handling HTTPS

  1. Store the certificate and the key files them under a safe location, that is a location which is not accessible from the Internet. If you are using a shared server, the folder should not be accessible to other users.

  2. Edit the Nginx configuration file to support SSL encryption. Use this configuration file and save it under the sites-enabled directory. If you followed the instructions on this page to install Nginx, you already have the right file.

  3. The second half of the Nginx configuration file contains the settings to enable SSL. Uncomment them, and comment the first half of the file.

  4. Replace the placeholders PATH_TO_YOUR_CERTIFICATE and PATH_TO_YOUR_SECRET_KEY with the location where you have previously saved the certificate and the key.

  5. If you have a domain name, replace the placeholder YOUR_DOMAIN_NAME with the name of your domain (without www in front).

  6. Restart Nginx.

  7. Start nodeGame normally (without the --ssl option, this is handled by Nginx).

Clone this wiki locally