gzip on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
gzip _min_length 1000;
gzip_buffers 168k
#设置负载均衡服务器列表
upstream mysvr {
server 192.168.1:80 weight=5;
server 192.168.1:80 weight=2;
server 192.168.1:80 weight=8;
}
#shorten the timeout period, original one is 300
fastcgi_connect_timeout 30;
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;
fastcgi_intercept_errors on;
fastcgi_hide_header Pragma;
# fastcgi cache
fastcgi_cache_path temp/fastcgi_cache levels=1:2 keys_zone=cache_voice:128m inactive=30m max_size=4G;
五. server块详解 #监听端口 listen 80; #服务域名 server_name www.xxx.com; #虚拟主机的访问日志 access_log /var/log/nginx/www.xxx.com_access.log main;#如果指定http错误状态码,则返回客户端指定的url地址
error_page 500 502 503 504 /50x.html;
location = 50x.html {
root /home/xiaoju/webroot;
}
六. location块详解 #定义网站根目录 root /home/xiaoju/webroot; #定义首页索引文件的名称 index index.php index.html index.htm; fastcgi_pass www.xx.com; fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name; include /etc/nginx/fastcgi_params;
#引入配置文件(可以放在配置文件的任意位置)
include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*;