Nginx-1.12.2编译安装
# vim /etc/nginx/nginx.conf userwww www;worker_processes8;
worker_cpu_affinity00000001 00000010 00000100 00001000 00010000 00100000 01000000 10000000;
worker_rlimit_nofile65535;
pid /var/run/nginx.pid;
events {
use epoll;
worker_connections65535;
}
http {
include mime.types;
default_typeapplication/octet-stream;
charset utf-8;
server_names_hash_bucket_size128;
server_names_hash_max_size512;
large_client_header_buffers4 64k;
client_max_body_size64m;
client_body_buffer_size1024k;
client_header_timeout15;
client_body_timeout15;
send_timeout30;
server_tokensoff;
sendfileon;
tcp_nopushon;
tcp_nodelayon;
keepalive_timeout60;
log_formatjson'{"@timestamp":"$time_iso8601", '
'"remote_addr": "$remote_addr", '
'"remote_user": "$remote_user", '
'"body_bytes_sent": "$body_bytes_sent", '
'"bytes_sent": "$bytes_sent", '
'"request_method": "$request_method", '
'"request": "$request", '
'"status": "$status", '
'"request_time": "$request_time", '
'"http_referrer": "$http_referer", '
'"http_x_forwarded_for": "$http_x_forwarded_for", '
'"http_user_agent": "$http_user_agent", '
'"country_code": "$geoip_city_country_code", '
'"country_code3": "$geoip_city_country_code3", '
'"city_country_name": "$geoip_city_country_name", '
'"region_name": "$geoip_region", '
'"city_name": "$geoip_city", '
'"city_continent_code": "$geoip_city_continent_code", '
'"longitude": "$geoip_longitude", '
'"latitude": "$geoip_latitude"} ';
gzipon;
gzip_min_length20k;
gzip_buffers8 32k;
gzip_http_version1.1;
gzip_comp_level6;
gzip_typestext/plain application/x-javascript text/javascript application/javascript text/css application/x-httpd-php image/jpeg image/gif image/png application/xml text/xml application/rss+xml application/octet-stream application/x-rar-compressed;
gzip_varyon;
gzip_disable"MSIE \.";
geoip_country/etc/nginx/conf.d/GeoIP.dat;
fastcgi_paramGEOIP_COUNTRY_CODE $geoip_country_code;
fastcgi_paramGEOIP_COUNTRY_CODE3 $geoip_country_code3;
fastcgi_paramGEOIP_COUNTRY_NAME $geoip_country_name;
geoip_city /etc/nginx/conf.d/GeoLiteCity.dat;
fastcgi_paramGEOIP_CITY_COUNTRY_CODE $geoip_city_country_code;
fastcgi_paramGEOIP_CITY_COUNTRY_CODE3 $geoip_city_country_code3;
fastcgi_paramGEOIP_CITY_COUNTRY_NAME $geoip_city_country_name;
fastcgi_paramGEOIP_REGION $geoip_region;
fastcgi_paramGEOIP_CITY $geoip_city;
fastcgi_paramGEOIP_CITY_CONTINENT_CODE $geoip_city_continent_code;
fastcgi_paramGEOIP_LONGITUDE $geoip_longitude;
fastcgi_paramGEOIP_LATITUDE $geoip_latitude;
fastcgi_connect_timeout300;
fastcgi_send_timeout300;
fastcgi_read_timeout300;
fastcgi_buffer_size128k;
fastcgi_buffers8 128k;
fastcgi_busy_buffers_size256k;
fastcgi_temp_file_write_size256k;
open_file_cachemax=65535 inactive=20s;
open_file_cache_min_uses1;
open_file_cache_valid60s;
server {
listen80 default_server;
server_name_;
return500;
}
include/etc/nginx/conf.d/vhost/*.conf;
}
# mkdir /etc/nginx/conf.d/vhost -p
# ls -ld /etc/nginx/conf.d/vhost/
drwxr-xr-x 2 root root 6 Mar 16 14:53 /etc/nginx/conf.d/vhost/
# gunzip GeoIP.dat.gz
# gunzip GeoLiteCity.dat.gz
# mv GeoIP.dat GeoLiteCity.dat /etc/nginx/conf.d/
页:
[1]