2020-07-30 12:57:34 +00:00
|
|
|
# nginx.conf -- docker-openresty
|
|
|
|
#
|
|
|
|
# This file is installed to:
|
|
|
|
# `/usr/local/openresty/nginx/conf/nginx.conf`
|
|
|
|
# and is the file loaded by nginx at startup,
|
|
|
|
# unless the user specifies otherwise.
|
|
|
|
#
|
|
|
|
# It tracks the upstream OpenResty's `nginx.conf`, but removes the `server`
|
|
|
|
# section and adds this directive:
|
|
|
|
# `include /etc/nginx/conf.d/*.conf;`
|
|
|
|
#
|
|
|
|
# The `docker-openresty` file `nginx.vh.default.conf` is copied to
|
|
|
|
# `/etc/nginx/conf.d/default.conf`. It contains the `server section
|
|
|
|
# of the upstream `nginx.conf`.
|
|
|
|
#
|
|
|
|
# See https://github.com/openresty/docker-openresty/blob/master/README.md#nginx-config-files
|
|
|
|
#
|
|
|
|
|
|
|
|
user root;
|
|
|
|
worker_processes 1;
|
|
|
|
|
|
|
|
#error_log logs/error.log;
|
|
|
|
#error_log logs/error.log notice;
|
|
|
|
#error_log logs/error.log info;
|
|
|
|
|
|
|
|
#pid logs/nginx.pid;
|
|
|
|
|
2021-06-16 11:06:49 +00:00
|
|
|
# declare env variables to use it in config
|
|
|
|
env SKYNET_PORTAL_API;
|
|
|
|
env SKYNET_SERVER_API;
|
|
|
|
env ACCOUNTS_ENABLED;
|
2020-07-30 12:57:34 +00:00
|
|
|
|
|
|
|
events {
|
|
|
|
worker_connections 1024;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
http {
|
|
|
|
include mime.types;
|
|
|
|
default_type application/octet-stream;
|
|
|
|
|
2020-09-09 08:17:12 +00:00
|
|
|
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
|
|
|
'$status $body_bytes_sent "$http_referer" '
|
|
|
|
'"$http_user_agent" $upstream_response_time '
|
|
|
|
'$upstream_bytes_sent $upstream_bytes_received '
|
2020-10-09 14:35:34 +00:00
|
|
|
'"$upstream_http_content_type" "$upstream_cache_status" '
|
2021-06-09 10:06:15 +00:00
|
|
|
'"$portal_domain" "$sent_http_skynet_skylink" '
|
2021-01-13 16:49:24 +00:00
|
|
|
'$upstream_connect_time $upstream_header_time '
|
|
|
|
'$request_time "$hns_domain"';
|
2020-07-30 12:57:34 +00:00
|
|
|
|
2020-09-09 08:17:12 +00:00
|
|
|
access_log logs/access.log main;
|
2020-07-30 12:57:34 +00:00
|
|
|
|
|
|
|
# See Move default writable paths to a dedicated directory (#119)
|
|
|
|
# https://github.com/openresty/docker-openresty/issues/119
|
|
|
|
client_body_temp_path /var/run/openresty/nginx-client-body;
|
|
|
|
proxy_temp_path /var/run/openresty/nginx-proxy;
|
|
|
|
fastcgi_temp_path /var/run/openresty/nginx-fastcgi;
|
|
|
|
uwsgi_temp_path /var/run/openresty/nginx-uwsgi;
|
|
|
|
scgi_temp_path /var/run/openresty/nginx-scgi;
|
|
|
|
|
|
|
|
sendfile on;
|
|
|
|
#tcp_nopush on;
|
|
|
|
|
|
|
|
#keepalive_timeout 0;
|
|
|
|
keepalive_timeout 65;
|
|
|
|
|
|
|
|
#gzip on;
|
|
|
|
|
2021-06-16 11:16:41 +00:00
|
|
|
# expose env variables as regular variables (env variables are not easily accessible in nginx)
|
2021-06-16 11:21:05 +00:00
|
|
|
set_by_lua $SKYNET_PORTAL_API 'return os.getenv("SKYNET_PORTAL_API")';
|
|
|
|
set_by_lua $SKYNET_SERVER_API 'return os.getenv("SKYNET_SERVER_API")';
|
|
|
|
set_by_lua $ACCOUNTS_ENABLED 'return os.getenv("ACCOUNTS_ENABLED")';
|
2021-06-16 11:16:41 +00:00
|
|
|
|
2021-02-18 09:10:04 +00:00
|
|
|
# include skynet-portal-api header on every request
|
|
|
|
header_filter_by_lua 'ngx.header["Skynet-Portal-Api"] = os.getenv("SKYNET_PORTAL_API")';
|
|
|
|
|
2020-07-30 12:57:34 +00:00
|
|
|
include /etc/nginx/conf.d/*.conf;
|
2021-04-01 13:15:37 +00:00
|
|
|
include /etc/nginx/conf.extra.d/*.conf;
|
2020-07-30 12:57:34 +00:00
|
|
|
}
|