又一个在家安心看书的日子,感觉很好,如果不要交房租,想这样生活三个月。nginx是每天工作都要用的东西,以前一直忙忙碌碌,想系统整理配置文件的事情想了很久,今天落实了。需要xmind源文件的底下留言,我email文件。
一 图解nginx.conf

二. nginx.conf例子:
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
| ###全局块开始###user nobody nobody; ##设置用户和用户组worker_processes 10; ##配置允许nginx生成的进程数error_log logs/error.log; ##配置错误日志路径及名称pid nginx.pid; ##配置进程pid存放位置##全局块结束#####events 块开始###events{ use epoll; ##配置事件的驱动模型 worker_connections 1024; ##配置每个进程的最大连接数}##events 块结束#####http块开始##http{ include mime.types; ##定义MIME_Type default_type application/octet-stream; sendfile on; ##允许使用sendfile方式 keepalive_timeout 75; ##配置连接的超时时间 log_format access.log '$remote_addr-[$time_local]-"$request"-"$http_user_agent"'; ##配置请求处理日志的格式 gzip on; #开启gzip gzip_min_length 1024; #响应页数据上限 gzip_buffers 4 16k; #缓存空间大小 gzip_comp_level 2; #压缩级别为2 gzip_types text/plain application/x-javascript text/css application/xml; #压缩源文件类型 gzip_vary on; #启用压缩标识 gunzip_static on; #检查预压缩文件 ##server 块开始## server{ listen 8081; ##监听端口 server_name www.luojia.ren; ##监听主机 access_log /myweb/server1/log/access.log; ##请求处理日志的存放路径 error_page 404 /404.html; ##配置错误页面 location /server1/location1{ ##配置处理/server1/location1的请求location root /myweb; index index.server1_location1.html; } location /server1/location2{ root /myweb; index index.server1_location2.html; } } server{ listen 8082; server_name 192.168.1.1; access_log /myweb/server1/log/access.log; error_page 404 /404.html; location /server1/location1{ root /myweb; index index.server1_location1.html; } location /server1/location2{ root /myweb; index index.server1_location2.html; } location=/404.html { ##配置错误页面转向 root /myweb/; index 404.html; } } ##server 块结束##}##http块结束## |