Browse Source

Added gzip, added X-Forwarded-For header, small improvements.

Martin Edenhofer 9 years ago
parent
commit
a6e0ba301c
1 changed files with 16 additions and 7 deletions
  1. 16 7
      contrib/nginx/sites-enabled/zammad.conf

+ 16 - 7
contrib/nginx/sites-enabled/zammad.conf

@@ -17,17 +17,26 @@ server {
     expires max;
   }
 
+  # proxy all to app server
+  location / {
+    proxy_set_header Host $http_host;
+    proxy_set_header CLIENT_IP $remote_addr;
+    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+    proxy_pass http://localhost:3000;
+
+    gzip on;
+    gzip_types text/html text/plain text/xml text/css image/svg+xml application/javascript application/x-javascript application/json application/xml;
+    gzip_proxied any;
+  }
+
+  # proxy web sockets to app server
   location /ws {
     proxy_http_version 1.1;
     proxy_set_header Upgrade $http_upgrade;
     proxy_set_header Connection "Upgrade";
-    proxy_pass http://localhost:6042;
-    proxy_read_timeout 86400;
-  }
-
-  location / {
-    proxy_set_header Host $host;
+    proxy_set_header CLIENT_IP $remote_addr;
     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
-    proxy_pass http://localhost:3000;
+    proxy_read_timeout 86400;
+    proxy_pass http://localhost:6042;
   }
 }