Skip to content

Commit

Permalink
uwsgi-friendly config GeoNode#2
Browse files Browse the repository at this point in the history
  • Loading branch information
cezio committed Mar 19, 2018
1 parent 0e80439 commit 8c3c0ae
Showing 1 changed file with 48 additions and 22 deletions.
70 changes: 48 additions & 22 deletions nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ http {
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /var/log/nginx/access.log main;
error_log /var/log/nginx/error.log;

sendfile on;
#tcp_nopush on;
Expand All @@ -33,18 +34,7 @@ http {
index index.html index.htm;
root /usr/share/nginx/html;

location /geoserver {
proxy_pass http://geoserver:8080/geoserver;

proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
client_max_body_size 100M;
}

location /{
proxy_pass http://django:8000;

location / {
if ($request_method = OPTIONS) {
add_header Access-Control-Allow-Methods "GET, POST, PUT, PATCH, OPTIONS";
add_header Access-Control-Allow-Headers "Authorization, Content-Type, Accept";
Expand All @@ -55,23 +45,59 @@ http {
return 200;
}

client_max_body_size 100M;
try_files $uri @django;
}

location @django {

include uwsgi_params;
uwsgi_pass uwsgi://django:8000;
uwsgi_read_timeout 30;

etag off;
expires 0;

client_max_body_size 15M;
client_body_buffer_size 128K;
add_header Access-Control-Allow-Credentials false;
add_header Access-Control-Allow-Headers "Content-Type, Accept, Authorization, Origin, User-Agent";
add_header Access-Control-Allow-Methods "GET, POST, PUT, PATCH, OPTIONS";
proxy_set_header X-Forwarded-Protocol $scheme;
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
send_timeout 600;
}


location /geoserver {
etag off;
expires 0;
proxy_pass http://geoserver:8080/geoserver;

proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
client_max_body_size 100M;
}
}

#include /etc/nginx/conf.d/*.conf;
# enable caching headers and gzipping content
etag on;
gzip on;

expires 1d;
gzip_disable "msie6";
gzip_comp_level 6;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_proxied any;
gzip_types
text/plain
text/css
text/js
text/xml
text/javascript
application/javascript
application/x-javascript
application/json
application/xml
application/rss+xml
image/svg+xml;

}
}

0 comments on commit 8c3c0ae

Please sign in to comment.