|
1 |
|
|
1
2
3 |
worker_processes 4; //一般是电脑核数的2倍 表示nginx启动时的进程数 worker_cpu_affinity 0001
0010 0100 1000; //指定了nginx在工作时候使用的cpu worker_rlimit_nofile 65535; //这个指令是指当一个nginx进程打开的最多文件描述符数目 |
|
1 |
|
|
1 |
<span><strong>参考博文</strong> http://www.howtocn.org/nginx:%E9%85%8D%E7%BD%AE%E4%B8%80%E4%B8%AA%E9%AB%98%E6%80%A7%E8%83%BD%E7%9A%84nginx_fastcgi%E6%9C%8D%E5%8A%A1%E5%99%A8</span> |

|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128 |
events { use epoll; worker_connections 65535;}http { include mime.types; default_type application/octet-stream; sendfile on; client_header_buffer_size 4k; keepalive_timeout 65; client_max_body_size 100m; charset utf-8; proxy_ignore_client_abort on; upstream oceanus { server 127.0.0.1:21530; } upstream wm { server 127.0.0.1:21520; } server { listen 80; server_name www.zjifa.com.cn; if
( $uri = ‘/‘
){ rewrite .* /index.html break; } location ~ ^/good(D|Z|X)/([0-9]+)$ { rewrite ^/good(D|Z|X)/([0-9]+)$ /productsList.html?category$1=$2; } location ~ ^/article/([0-9]+)$ { rewrite ^/article/([0-9]+)$ /articleList.html?categoryID=$1; } #swf location ~ ^/crossdomain.xml { root /data/oceanus/enterprise/static/html; } location ~ ^/www/upfiles/.+ { root /data/oceanus/enterprise/oceanus-21530-21535-21536/webapps/; } location / { proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://oceanus; } error_page 500
502 503 504 /50x.html; location = /50x.html { root html; } } server { listen 80; server_name i.zjifa.com.cn; if
( $uri = ‘/‘
){ rewrite .* /user/login.html break; } location / { proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://wm; } error_page 500
502 503 504 /50x.html; location = /50x.html { root html; } } server { listen 80; server_name static.zjifa.com.cn; location ~ ^/goods/pre/([a-zA-Z0-9_]+)\.(jpg|gif|png) { rewrite ^/goods/pre/([a-zA-Z0-9_]+)\.(jpg|gif|png) /goods/pre_/$1_$arg_m.$2?version=$arg_version; } location ~ ^/goods/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)\.(jpg|gif|png) { rewrite ^/goods/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)\.(jpg|gif|png) /goods/$1/$2/$3/$4_$arg_m.$5?version=$arg_version; } location ~ ^/www/upfiles/.+ { root /data/oceanus/enterprise/static/html/; } location / { root /data/oceanus/enterprise/static/html; } } server { listen 80; server_name image.zjifa.com.cn; location ~ ^/goods/pre/([a-zA-Z0-9_]+)\.(jpg|gif|png) { rewrite ^/goods/pre/([a-zA-Z0-9_]+)\.(jpg|gif|png) /goods/pre_/$1_$arg_m.$2?version=$arg_version; } location ~ ^/goods/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)\.(jpg|gif|png) { rewrite ^/goods/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)\.(jpg|gif|png) /goods/$1/$2/$3/$4_$arg_m.$5?version=$arg_version; } location ~ ^/advertisement/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)\.(jpg|gif|png) { rewrite ^/advertisement/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)\.(jpg|gif|png) /advertisement/$1/$2/$3/$4_$arg_m.$5?version=$arg_version; } location ~ ^/www/upfiles/.+ { root /data/oceanus/enterprise/static/image/; } location / { root /data/oceanus/enterprise/static/image; } }} |
原文:http://www.cnblogs.com/javafengyi/p/3542380.html