Document configuration for Nginx
authorRaphaël Jakse <raphael.trivabble@jakse.fr>
Sat, 5 Sep 2020 06:47:23 +0000 (08:47 +0200)
committerRaphaël Jakse <raphael.trivabble@jakse.fr>
Sat, 5 Sep 2020 06:47:23 +0000 (08:47 +0200)
README.md

index 8e898ed5667286fc5833ade067d49b3e162e1a9f..892b068666f1c8c3fbc927596e9d2fea885867e2 100644 (file)
--- a/README.md
+++ b/README.md
@@ -135,9 +135,11 @@ We will assume www-data is the UNIX user of your Web server. Adapt if necessary.
         exec sudo -u www-data DEBUG_LOG=true nodejs trivabble-server.js
         ```
 
-8. Configure your web server.
+8. Configure your web server. In the next two sections, we describe the configuration for Apache 2 and Nginx.
 
-On Apache 2,  the relevant rules are:
+#### Apache 2
+
+On Apache 2, the relevant rules are:
 
     RewriteEngine on
     RewriteRule "^/?:trivabble/ws/(.*)" ws://localhost:3000/ws/$1 [P]
@@ -153,10 +155,41 @@ a2enmod proxy_wstunnel
 a2enmod rewrite
 ```
 
-A full example is available in (doc/trivabble-apache-host.conf.sample)[doc/trivabble-apache-host.conf.sample].
-
 :warning: Be careful to allow enough concurrent processes / threads / workers on your web server.
 Each player requires one long-standing connection (XHR, SSE or WebSocket), plus small requests when not using WebSockets.
+Long-standing connections may cause issues with Apache 2, and using HTTP 2 may lead to "interesting" behavior.
+
+### Nginx
+
+Here is an example of an Nginx configuration for Trivabble:
+
+```
+server {
+        listen 443 ssl http2;
+        listen [::]:443 ssl http2;
+
+        server_name trivabble.example.org;
+
+        location /:trivabble/ws/ {
+                proxy_pass http://127.0.0.1:3000;
+                proxy_http_version 1.1;
+                proxy_set_header Upgrade $http_upgrade;
+                proxy_set_header Connection "Upgrade";
+                proxy_set_header Host $host;
+        }
+
+        location /:trivabble {
+                proxy_pass http://127.0.0.1:3000;
+                proxy_buffering off;
+        }
+
+        location /trivabble {
+                alias /var/www/html/trivabble-public;
+        }
+
+       # SSL configuration here
+}
+```
 
 ## Enable the spell checker