mirror of
https://github.com/apache/superset.git
synced 2024-09-11 16:19:43 -04:00
128 lines
4.0 KiB
Nginx Configuration File
128 lines
4.0 KiB
Nginx Configuration File
|
#
|
||
|
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||
|
# contributor license agreements. See the NOTICE file distributed with
|
||
|
# this work for additional information regarding copyright ownership.
|
||
|
# The ASF licenses this file to You under the Apache License, Version 2.0
|
||
|
# (the "License"); you may not use this file except in compliance with
|
||
|
# the License. You may obtain a copy of the License at
|
||
|
#
|
||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||
|
#
|
||
|
# Unless required by applicable law or agreed to in writing, software
|
||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
# See the License for the specific language governing permissions and
|
||
|
# limitations under the License.
|
||
|
#
|
||
|
user nginx;
|
||
|
worker_processes 1;
|
||
|
|
||
|
error_log /var/log/nginx/error.log warn;
|
||
|
pid /var/run/nginx.pid;
|
||
|
|
||
|
|
||
|
events {
|
||
|
worker_connections 1024;
|
||
|
}
|
||
|
|
||
|
|
||
|
http {
|
||
|
include /etc/nginx/mime.types;
|
||
|
default_type application/octet-stream;
|
||
|
|
||
|
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||
|
'$status $body_bytes_sent [$connection_requests] "$http_referer" '
|
||
|
'"$http_user_agent" "$http_x_forwarded_for"';
|
||
|
|
||
|
access_log /var/log/nginx/access.log main;
|
||
|
|
||
|
sendfile on;
|
||
|
#tcp_nopush on;
|
||
|
|
||
|
keepalive_timeout 30;
|
||
|
keepalive_requests 2;
|
||
|
|
||
|
###### Compression Stuff
|
||
|
|
||
|
# Enable Gzip compressed.
|
||
|
gzip on;
|
||
|
|
||
|
# Compression level (1-9).
|
||
|
# 5 is a perfect compromise between size and cpu usage, offering about
|
||
|
# 75% reduction for most ascii files (almost identical to level 9).
|
||
|
gzip_comp_level 5;
|
||
|
|
||
|
# Don't compress anything that's already small and unlikely to shrink much
|
||
|
# if at all (the default is 20 bytes, which is bad as that usually leads to
|
||
|
# larger files after gzipping).
|
||
|
gzip_min_length 256;
|
||
|
|
||
|
# Compress data even for clients that are connecting to us via proxies,
|
||
|
# identified by the "Via" header (required for CloudFront).
|
||
|
gzip_proxied any;
|
||
|
|
||
|
# Tell proxies to cache both the gzipped and regular version of a resource
|
||
|
# whenever the client's Accept-Encoding capabilities header varies;
|
||
|
# Avoids the issue where a non-gzip capable client (which is extremely rare
|
||
|
# today) would display gibberish if their proxy gave them the gzipped version.
|
||
|
gzip_vary on;
|
||
|
|
||
|
# Compress all output labeled with one of the following MIME-types.
|
||
|
gzip_types
|
||
|
application/atom+xml
|
||
|
application/javascript
|
||
|
application/json
|
||
|
application/rss+xml
|
||
|
application/vnd.ms-fontobject
|
||
|
application/x-font-ttf
|
||
|
application/x-web-app-manifest+json
|
||
|
application/xhtml+xml
|
||
|
application/xml
|
||
|
font/opentype
|
||
|
image/svg+xml
|
||
|
image/x-icon
|
||
|
text/css
|
||
|
text/plain
|
||
|
text/x-component;
|
||
|
# text/html is always compressed by HttpGzipModule
|
||
|
|
||
|
output_buffers 20 10m;
|
||
|
|
||
|
client_max_body_size 10m;
|
||
|
|
||
|
upstream superset_app {
|
||
|
server host.docker.internal:8088;
|
||
|
keepalive 100;
|
||
|
}
|
||
|
|
||
|
upstream superset_websocket {
|
||
|
server host.docker.internal:8080;
|
||
|
keepalive 100;
|
||
|
}
|
||
|
|
||
|
server {
|
||
|
listen 80 default_server;
|
||
|
server_name _;
|
||
|
|
||
|
location /ws {
|
||
|
proxy_pass http://superset_websocket;
|
||
|
proxy_http_version 1.1;
|
||
|
proxy_set_header Upgrade $http_upgrade;
|
||
|
proxy_set_header Connection "Upgrade";
|
||
|
proxy_set_header Host $host;
|
||
|
}
|
||
|
|
||
|
location / {
|
||
|
proxy_pass http://superset_app;
|
||
|
proxy_set_header Host $host;
|
||
|
proxy_set_header X-Real-IP $remote_addr;
|
||
|
proxy_set_header X-Forwarded-For $remote_addr;
|
||
|
proxy_set_header X-Forwarded-Host $host;
|
||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||
|
proxy_http_version 1.1;
|
||
|
port_in_redirect off;
|
||
|
proxy_connect_timeout 300;
|
||
|
}
|
||
|
}
|
||
|
}
|