diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..5d038a6 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,82 @@ +user nginx; +worker_processes 1; +error_log /var/log/nginx/error.log warn; +pid /var/run/nginx.pid; +load_module /usr/lib/nginx/modules/ngx_http_geoip2_module.so; # GeoIP2 +events { + worker_connections 1024; +} +http { + variables_hash_bucket_size 64; + variables_hash_max_size 2048; + server_tokens off; + sendfile on; + tcp_nopush on; + tcp_nodelay on; + autoindex off; + keepalive_timeout 30; + types_hash_bucket_size 256; + client_max_body_size 100m; + server_names_hash_bucket_size 256; + #set_real_ip_from xxx.xxx.xxx.xxx; + real_ip_header X-Forwarded-For; + real_ip_recursive on; + include mime.types; + default_type application/octet-stream; + + index index.php index.html index.htm; + # GeoIP2 + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + # GeoIP2 + log_format main_geo '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for" ' + '$geoip2_data_country_iso $geoip2_data_country_name'; + + access_log /var/log/nginx/access.log main_geo; # GeoIP2 +#===================== GEOIP2 =====================# + geoip2 /usr/share/geoip/GeoLite2-Country.mmdb { + $geoip2_metadata_country_build metadata build_epoch; + $geoip2_data_country_geonameid country geoname_id; + $geoip2_data_country_iso country iso_code; + $geoip2_data_country_name country names en; + $geoip2_data_country_is_eu country is_in_european_union; + } + #geoip2 /usr/share/geoip/GeoLite2-City.mmdb { + # $geoip2_data_city_name city names en; + # $geoip2_data_city_geonameid city geoname_id; + # $geoip2_data_continent_code continent code; + # $geoip2_data_continent_geonameid continent geoname_id; + # $geoip2_data_continent_name continent names en; + # $geoip2_data_location_accuracyradius location accuracy_radius; + # $geoip2_data_location_latitude location latitude; + # $geoip2_data_location_longitude location longitude; + # $geoip2_data_location_metrocode location metro_code; + # $geoip2_data_location_timezone location time_zone; + # $geoip2_data_postal_code postal code; + # $geoip2_data_rcountry_geonameid registered_country geoname_id; + # $geoip2_data_rcountry_iso registered_country iso_code; + # $geoip2_data_rcountry_name registered_country names en; + # $geoip2_data_rcountry_is_eu registered_country is_in_european_union; + # $geoip2_data_region_geonameid subdivisions 0 geoname_id; + # $geoip2_data_region_iso subdivisions 0 iso_code; + # $geoip2_data_region_name subdivisions 0 names en; + #} + +#=================Basic Compression=================# + gzip on; + gzip_disable "msie6"; + gzip_vary on; + gzip_proxied any; + gzip_comp_level 6; + gzip_buffers 16 8k; + gzip_http_version 1.1; + gzip_types text/css text/xml text/plain application/javascript image/jpeg image/png image/gif image/x-icon image/svg+xml image/webp application/font-woff application/json application/vnd.ms-fontobject application/vnd.ms-powerpoint; + gzip_static on; + +#=================Configuration Files=================# + include /etc/nginx/conf.d/*.conf; +}