-
Notifications
You must be signed in to change notification settings - Fork 18
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.
-
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.
-
-
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.
-
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.
-
Store the certificate and the key files inside the nodegame-server folder
node_modules/nodegame-server/ssl/
. The files must be named:certificate.pem
andprivate.key
. -
Then you can start the server with the
ssl
option:node launcher --ssl
-
Additional SSL options are available. See them typing:
node launcher --help
.
-
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.
-
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.
-
The second half of the Nginx configuration file contains the settings to enable SSL. Uncomment them, and comment the first half of the file.
-
Replace the placeholders
PATH_TO_YOUR_CERTIFICATE
andPATH_TO_YOUR_SECRET_KEY
with the location where you have previously saved the certificate and the key. -
If you have a domain name, replace the placeholder
YOUR_DOMAIN_NAME
with the name of your domain (without www in front). -
Restart Nginx.
-
Start nodeGame normally (without the --ssl option, this is handled by Nginx).
Go back to the wiki Home.
Copyright (C) 2021 Stefano Balietti
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.