Skip to content

nodeGame with Nginx

Stefano Balietti edited this page Apr 11, 2020 · 3 revisions

Install Nginx

Nginx is an open source web server known for its efficiency and robustness. You can put "in front" of nodeGame to handle all incoming connections. Technically this is called a reverse proxy to nodeGame. Here are the steps to setup it.

  1. Install Nginx following the instructions on their website.

  2. Copy the Nginx default configuration file and save it under the correct location for your operating system:

    • Linux/Mac: /etc/nginx/sites-enabled/.
    • Windows: C:/nginx/conf/sites-enabled/ (more details)
  3. Restart Nginx to load the new configuration.

  4. Nginx is now listening on port 80, so you need to make sure nodeGame is listening to another port. Let's pick 8080, or whatever you have specified in the nginx conf file. Inside the nodeGame root directory edit the file:

    conf/servernode.js

    and set:

    servernode.port = 8080;

  5. Start nodeGame as usual, and it will now receive all the incoming connections from Nginx.

SSL (https://)

Read HTTPS wiki page for a guide how to setup Nginx to support SSL encryption.

Clone this wiki locally