|
[root@linux-node1 ~]# vim /etc/nginx/nginx.conf user www www;
worker_processes 8;
worker_cpu_affinity 00000001 00000010 00000100 00001000 00010000 00100000 01000000 10000000;
worker_rlimit_nofile 65535;
pid /var/run/nginx.pid;
events {
use epoll;
worker_connections 65535;
}
http {
include mime.types;
default_type application/octet-stream;
charset utf-8;
server_names_hash_bucket_size 128;
server_names_hash_max_size 512;
large_client_header_buffers 4 64k;
client_max_body_size 64m;
client_body_buffer_size 1024k;
client_header_timeout 15;
client_body_timeout 15;
send_timeout 30;
server_tokens off;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 60;
log_format json '{"@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"} ';
gzip on;
gzip_min_length 20k;
gzip_buffers 8 32k;
gzip_http_version 1.1;
gzip_comp_level 6;
gzip_types text/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_vary on;
gzip_disable "MSIE [1-6]\.";
geoip_country /etc/nginx/conf.d/GeoIP.dat;
fastcgi_param GEOIP_COUNTRY_CODE $geoip_country_code;
fastcgi_param GEOIP_COUNTRY_CODE3 $geoip_country_code3;
fastcgi_param GEOIP_COUNTRY_NAME $geoip_country_name;
geoip_city /etc/nginx/conf.d/GeoLiteCity.dat;
fastcgi_param GEOIP_CITY_COUNTRY_CODE $geoip_city_country_code;
fastcgi_param GEOIP_CITY_COUNTRY_CODE3 $geoip_city_country_code3;
fastcgi_param GEOIP_CITY_COUNTRY_NAME $geoip_city_country_name;
fastcgi_param GEOIP_REGION $geoip_region;
fastcgi_param GEOIP_CITY $geoip_city;
fastcgi_param GEOIP_CITY_CONTINENT_CODE $geoip_city_continent_code;
fastcgi_param GEOIP_LONGITUDE $geoip_longitude;
fastcgi_param GEOIP_LATITUDE $geoip_latitude;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 128k;
fastcgi_buffers 8 128k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
open_file_cache max=65535 inactive=20s;
open_file_cache_min_uses 1;
open_file_cache_valid 60s;
server {
listen 80 default_server;
server_name _;
return 500;
}
include /etc/nginx/conf.d/vhost/*.conf;
}
[root@linux-node1 ~]# mkdir /etc/nginx/conf.d/vhost -p
[root@linux-node1 ~]# ls -ld /etc/nginx/conf.d/vhost/
drwxr-xr-x 2 root root 6 Mar 16 14:53 /etc/nginx/conf.d/vhost/
[root@linux-node1 ~]# gunzip GeoIP.dat.gz
[root@linux-node1 ~]# gunzip GeoLiteCity.dat.gz
[root@linux-node1 ~]# mv GeoIP.dat GeoLiteCity.dat /etc/nginx/conf.d/
|
|
|