dockerfiles/telize/nginx.conf

126 lines
3.6 KiB
Nginx Configuration File
Raw Permalink Normal View History

include /etc/nginx/modules-enabled/*;
user nginx;
worker_processes 2;
worker_rlimit_nofile 8192;
pid /run/nginx.pid;
events {
worker_connections 8000;
# multi_accept on;
}
http {
server_tokens off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Update charset_types due to updated mime.types
charset_types text/xml text/plain text/vnd.wap.wml application/x-javascript application/rss+xml text/css application/javascript application/json;
# Format to use in log files
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
##
# Logging Settings
##
access_log /var/log/nginx/access.log main;
error_log /var/log/nginx/error.log warn;
# How long to allow each connection to stay idle; longer values are better
# for each individual client, particularly for SSL, but means that worker
# connections are tied up longer. (Default: 65)
keepalive_timeout 20;
# Speed up file transfers by using sendfile() to copy directly
# between descriptors rather than using read()/write().
sendfile on;
# Tell Nginx not to send out partial frames; this increases throughput
# since TCP frames are filled up before being sent out. (adds TCP_CORK)
tcp_nopush on;
# Compression
# 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
##
# GeoIP
##
map_hash_bucket_size 64;
map_hash_max_size 8192;
include /etc/nginx/country-code3.conf;
include /etc/nginx/timezone-offset.conf;
geoip2 /usr/share/GeoIP/GeoLite2-City.mmdb {
$geoip2_continent_code continent code;
$geoip2_country country names en;
$geoip2_country_code country iso_code;
$geoip2_region subdivisions 0 names en;
$geoip2_region_code subdivisions 0 iso_code;
$geoip2_city city names en;
$geoip2_postal_code postal code;
$geoip2_latitude location latitude;
$geoip2_longitude location longitude;
$geoip2_timezone location time_zone;
}
geoip2 /usr/share/GeoIP/GeoLite2-ASN.mmdb {
$geoip2_asn autonomous_system_number;
$geoip2_organization autonomous_system_organization;
}
# Virtual hosts
include /etc/nginx/conf.d/telize.conf;
}