Have nginx serve the static files to not overwhelm flask.

This commit is contained in:
Ubuntu 2013-10-02 21:21:22 +00:00
parent fc80616eab
commit 06b1e1466f

View file

@ -10,6 +10,8 @@ events {
} }
http { http {
include /etc/nginx/mime.types;
default_type application/octet-stream; default_type application/octet-stream;
access_log /tmp/nginx.access.log combined; access_log /tmp/nginx.access.log combined;
sendfile on; sendfile on;
@ -33,9 +35,6 @@ http {
keepalive_timeout 5; keepalive_timeout 5;
# path for static files
root /home/ubuntu/quay/static;
ssl on; ssl on;
ssl_certificate /home/ubuntu/quay/certs/unified.cert; ssl_certificate /home/ubuntu/quay/certs/unified.cert;
ssl_certificate_key /home/ubuntu/quay/certs/quay.key; ssl_certificate_key /home/ubuntu/quay/certs/quay.key;
@ -44,13 +43,14 @@ http {
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP; ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP;
ssl_prefer_server_ciphers on; ssl_prefer_server_ciphers on;
location / { location /static/ {
# checks for static file, if not found proxy to app # checks for static file, if not found proxy to app
try_files $uri @proxy_to_app; alias /home/ubuntu/quay/static/;
} }
location @proxy_to_app { location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host; proxy_set_header Host $http_host;
proxy_redirect off; proxy_redirect off;
proxy_buffering off; proxy_buffering off;