Showing
1 changed file
with
132 additions
and
0 deletions
global-proxy/nginx.conf
0 → 100644
1 | +user www www; | ||
2 | + | ||
3 | +worker_processes 8; | ||
4 | +worker_cpu_affinity 00000001 00000010 00000100 00001000 00010000 00100000 01000000 10000000; | ||
5 | + | ||
6 | +pid /Data/local/nginx-1.8.0/logs/nginx.pid; | ||
7 | +# [ debug | info | notice | warn | error | crit ] | ||
8 | +#error_log /Data/logs/nginx/nginx_error.log; | ||
9 | +#error_log /dev/null; | ||
10 | +#Specifies the value for maximum file descriptors that can be opened by this process. | ||
11 | +worker_rlimit_nofile 51200; | ||
12 | + | ||
13 | +events | ||
14 | +{ | ||
15 | + use epoll; | ||
16 | + | ||
17 | + #maxclient = worker_processes * worker_connections / cpu_number | ||
18 | + worker_connections 51200; | ||
19 | +} | ||
20 | + | ||
21 | +http | ||
22 | +{ | ||
23 | + allow 218.94.75.50; | ||
24 | + allow 218.94.75.58; | ||
25 | + allow 123.56.138.21; | ||
26 | + allow 123.57.153.187; | ||
27 | + allow 123.56.238.71; | ||
28 | + allow 123.206.51.23; | ||
29 | + allow 54.222.0.0/16; | ||
30 | + deny all; | ||
31 | + include /Data/local/nginx-1.8.0/conf/mime.types; | ||
32 | + default_type application/octet-stream; | ||
33 | + #charset gb2312,utf-8; | ||
34 | + charset utf-8; | ||
35 | + | ||
36 | + log_format fenxi '$remote_addr|$http_x_forwarded_for|[$time_local]|$http_host|$request|' | ||
37 | + '$status|$body_bytes_sent|$request_time|$upstream_response_time|$upstream_cache_status|$http_referer|' | ||
38 | + '$http_user_agent'; | ||
39 | + | ||
40 | + #log_format main '$remote_addr - $remote_user [$time_local] $request $request_body ' | ||
41 | + # '"$status" $body_bytes_sent "$http_referer" ' | ||
42 | + # '"$http_user_agent" "$http_x_forwarded_for" "$request_time"'; | ||
43 | + # | ||
44 | + #access_log /Data/logs/access_yohoshow.com.log main; | ||
45 | + access_log off; | ||
46 | + error_log off; | ||
47 | + #error_page 502 =200 /.busy.jpg; | ||
48 | + #error_page 403 = http://www.yohoboys.com; | ||
49 | + #error_page 404 = http://www.yohoboys.com; | ||
50 | + #General Options | ||
51 | + server_names_hash_bucket_size 128; | ||
52 | + client_header_buffer_size 32k; | ||
53 | + large_client_header_buffers 4 32k; | ||
54 | + client_body_buffer_size 8m; #256k | ||
55 | + # | ||
56 | + #server_tokens off; | ||
57 | + ignore_invalid_headers on; | ||
58 | + recursive_error_pages on; | ||
59 | + server_name_in_redirect off; | ||
60 | + | ||
61 | + sendfile on; | ||
62 | + | ||
63 | + #timeouts | ||
64 | + keepalive_timeout 60; | ||
65 | + #test | ||
66 | + #client_body_timeout 3m; | ||
67 | + #client_header_timeout 3m; | ||
68 | + #send_timeout 3m; | ||
69 | + | ||
70 | + | ||
71 | + #TCP Options | ||
72 | + tcp_nopush on; | ||
73 | + tcp_nodelay on; | ||
74 | + | ||
75 | + #fastcgi options | ||
76 | + fastcgi_connect_timeout 300; | ||
77 | + fastcgi_send_timeout 300; | ||
78 | + fastcgi_read_timeout 300; | ||
79 | + fastcgi_buffer_size 64k; | ||
80 | + fastcgi_buffers 4 64k; | ||
81 | + fastcgi_busy_buffers_size 128k; | ||
82 | + fastcgi_temp_file_write_size 128k; | ||
83 | + | ||
84 | + set_real_ip_from 10.159.191.0/24; | ||
85 | + real_ip_header X-Forwarded-For; | ||
86 | + | ||
87 | + #hiden php version | ||
88 | + fastcgi_hide_header X-Powered-By; | ||
89 | + | ||
90 | + #size limits | ||
91 | + client_max_body_size 50m; | ||
92 | + | ||
93 | + gzip on; | ||
94 | + gzip_min_length 1k; | ||
95 | + gzip_buffers 4 16k; | ||
96 | + gzip_http_version 1.0; | ||
97 | + gzip_comp_level 2; | ||
98 | + gzip_types text/plain application/x-javascript text/css application/xml; | ||
99 | + gzip_vary on; | ||
100 | + | ||
101 | + #proxy_temp_path /dev/shm/proxy_temp; | ||
102 | + proxy_temp_path /Data/local/nginx-1.8.0/ngx_temp_dir; | ||
103 | + proxy_cache_path /Data/local/nginx-1.8.0/ngx_cache levels=1:2 keys_zone=cache_one:500m inactive=1d max_size=10g; | ||
104 | + proxy_connect_timeout 5; | ||
105 | + proxy_read_timeout 60; | ||
106 | + proxy_send_timeout 5; | ||
107 | + proxy_buffer_size 16k; | ||
108 | + proxy_buffers 4 64k; | ||
109 | + proxy_busy_buffers_size 128k; | ||
110 | + proxy_temp_file_write_size 128k; | ||
111 | + | ||
112 | + fastcgi_temp_path /dev/shm/fastcgi_temp; | ||
113 | + client_body_temp_path /dev/shm/client_body_temp; | ||
114 | + | ||
115 | + #upstream web | ||
116 | + upstream varnish { | ||
117 | + server 127.0.0.1:8081 weight=6 max_fails=2 fail_timeout=5s; | ||
118 | +} | ||
119 | + | ||
120 | + #upstream | ||
121 | + fastcgi_next_upstream error timeout invalid_header http_500; | ||
122 | + | ||
123 | + #limit_zone limit $binary_remote_addr 1m; | ||
124 | + limit_req_zone $binary_remote_addr zone=one:50m rate=20r/s; | ||
125 | + limit_req_zone $binary_remote_addr zone=new:30m rate=50r/s; | ||
126 | + limit_req_zone $binary_remote_addr zone=hibox:10m rate=20r/s; | ||
127 | + | ||
128 | + #fastcgi cache | ||
129 | + #fastcgi_cache_path /nginxcache levels=1:2 keys_zone=two:10m inactive=1d max_size=3000m; | ||
130 | + #for example just for study! have fun! | ||
131 | + include vhosts/*.conf; | ||
132 | +} |
-
Please register or login to post a comment