您的位置:首页 > 运维架构 > Nginx

windows下配置nginx(gzip+SSI+Expires)

2012-05-02 02:42 393 查看
windows下配置nginx(gzip+SSI+Expires)

1#usernobody;
2worker_processes1;
3
4#error_loglogs/error.log;
5#error_loglogs/error.lognotice;
6#error_loglogs/error.loginfo;
7
8#pidlogs/nginx.pid;
9
10
11events{
12worker_connections1024;
13}
14
15
16http{
17includemime.types;
18default_typeapplication/octet-stream;
19
20#log_formatmain'$remote_addr-$remote_user[$time_local]"$request"'
21#'$status$body_bytes_sent"$http_referer"'
22#'"$http_user_agent""$http_x_forwarded_for"';
23
24#access_loglogs/access.logmain;
25
26sendfileon;
27#tcp_nopushon;
28
29#keepalive_timeout0;
30keepalive_timeout65;
31
32#gzipon;
33gzipon;
34gzip_min_length1024;
35gzip_buffers48k;
36gzip_comp_level6;
37gzip_typestext/plaintext/cssapplication/jsonapplication/x-javascripttext/xmlapplication/xmlapplication/xml+rsstext/javascript;
38gzip_varyon;
39
40server{
41listen80;
42server_namelocalhost;
43
44#charsetkoi8-r;
45
46#access_loglogs/host.access.logmain;
47
48location/{
49roothtml;
50indexindex.htmlindex.htm;
51}
52
53#error_page404/404.html;
54
55#redirectservererrorpagestothestaticpage/50x.html
56#
57error_page500502503504/50x.html;
58location=/50x.html{
59roothtml;
60}
61
62#proxythePHPscriptstoApachelisteningon127.0.0.1:80
63#
64#location~\.php${
65#proxy_passhttp://127.0.0.1;66#}
67
68#passthePHPscriptstoFastCGIserverlisteningon127.0.0.1:9000
69#
70#location~\.php${
71#roothtml;
72#fastcgi_pass127.0.0.1:9000;
73#fastcgi_indexindex.php;
74#fastcgi_paramSCRIPT_FILENAME/scripts$fastcgi_script_name;
75#includefastcgi_params;
76#}
77
78#denyaccessto.htaccessfiles,ifApache'sdocumentroot
79#concurswithnginx'sone
80#
81#location~/\.ht{
82#denyall;
83#}
84
85#NginxExpires
86location~.*\.(gif|jpg|jpeg|png|bmp|swf|ico)${
87expires7d;
88}
89location~.*\.(js|css|html)?${
90expires7d;
91}
92}
93
94
95#anothervirtualhostusingmixofIP-,name-,andport-basedconfiguration
96#
97#server{
98#listen8000;
99#listensomename:8080;
100#server_namesomenamealiasanother.alias;
101
102#location/{
103#roothtml;
104#indexindex.htmlindex.htm;
105#}
106#}
107
108
109#HTTPSserver
110#
111#server{
112#listen443;
113#server_namelocalhost;
114
115#sslon;
116#ssl_certificatecert.pem;
117#ssl_certificate_keycert.key;
118
119#ssl_session_timeout5m;
120
121#ssl_protocolsSSLv2SSLv3TLSv1;
122#ssl_ciphersHIGH:!aNULL:!MD5;
123#ssl_prefer_server_cipherson;
124
125#location/{
126#roothtml;
127#indexindex.htmlindex.htm;
128#}
129#}
130
131#loadinginclude
132ssion;
133ssi_silent_errorson;
134ssi_typestext/shtml;
135
136}
模块
#gzipon;
#NginxExpires
#loadinginclude
----------------------------------无辜的分割线------------------------------------
开启:startnginx
重启:nginx-sreload
关闭:nginx-squit
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  nginx