Prechádzať zdrojové kódy

[load-balancer] Add static file caching to nginx config

Erick Tryzelaar 10 rokov pred
rodič
commit
b22e3ab

+ 17 - 0
tools/load-balancer/etc/nginx.conf

@@ -10,6 +10,10 @@ events {
 http {
     sendfile on;
 
+    # This may be different depending on the platform.
+    include /etc/nginx/mime.types;
+    default_type application/octet-stream;
+
     access_log logs/nginx_access.log;
 
     server {
@@ -20,6 +24,19 @@ http {
         location / {
             proxy_pass http://hue;
         }
+
+        location /static/ {
+            autoindex on;
+
+            # The default Hue staticfile packaging installation directory.
+            alias /usr/lib/hue/build/static/;
+
+            # The default Hue staticfile parcel installation directory.
+            ## /opt/cloudera/parcels/CDH/lib/hue/build/static/;
+
+            expires 30d;
+            add_header Cache-Control public;
+        }
     }
 
     include ../var/nginx-hue.conf;

+ 1 - 1
tools/load-balancer/etc/supervisor.d/nginx.conf

@@ -1,4 +1,4 @@
 [program:nginx]
-command=nginx -p %(here)s/.. -c etc/nginx.conf
+command=nginx -p %(here)s/../ -c etc/nginx.conf
 autostart=true
 autorestart=false