zabbix server源码安装
userdeamon;worker_processes
8;#指定了要开启的进程数,每进程占用10M~12M的内存,建议和CPU的核心数量一样多的进程就行了。
error_log
/var/log/nginx/error.log warn;
pid
/var/run/nginx/nginx.pid;
#Specifies the value
for maximum file descriptors that can be opened by this process.
#events 用来指定Nginx工作模式以及连接数上限
events {
use epoll;#使用epoll高效模式,适用于Linux,Unix使用kqueue
worker_connections
100000; #定义Ningx没个进程最大的连接数。默认为1024,受到文件句柄的约束。
}
worker_rlimit_nofile
100000; #打开的文件句柄数量最高为10万
http {
include mime.types;
default_typeapplication
/octet-stream;
log_formatmain
'$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log/var/log/nginx/access.logmain;
sendfile on;
#tcp_nopush on;
#keepalive_timeout0;
keepalive_timeout65;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k; #客户端请求头部的缓冲区大小,一般一个请求头的大小不会超过1k
large_client_header_buffers 4 32k; #客户请求头缓冲大小 nginx默认会用client_header_buffer_size这个buffer来读取header值
client_max_body_size 8m; #设定通过nginx上传文件的大小
gzip on; #该指令用于开启或关闭gzip模块(on/off)
gzip_min_length 1k; #设置允许压缩的页面最小字节数,页面字节数从header头得content-length中进行获取
gzip_buffers 4 16k; #设置系统获取几个单位的缓存用于存储gzip的压缩结果数据流
gzip_http_version 1.0; #识别http的协议版本
gzip_comp_level 2; #gzip压缩比,1压缩比最小处理速度最快
#匹配mime类型进行压缩,无论是否指定,”text/html”类型总是会被压缩的
gzip_types text/plain application/x-javascript text/css application/xml text/javascript;
gzip_vary on; #和http头有关系,加个vary头,给代理服务器用的
charset utf-8;#字符集为utf-8
access_log off; # 日常日志关闭
log_not_found off; # 日常日志关闭
#fastcgi_temp_path/etc/nginx/tmp;
#fastcgi_cache_path /etc/nginx/cache levels=1:2 keys_zone=MYAPP:100m inactive=60m;
#fastcgi_cache_key " request_method request_uri";
fastcgi_connect_timeout 300; #指定连接到后端FastCGI的超时时间。
fastcgi_send_timeout 300; #向FastCGI传送请求的超时时间,这个值是指已经完成两次握手后向FastCGI传送请求的超时时间。
fastcgi_read_timeout 300; #接收FastCGI应答的超时时间,这个值是指已经完成两次握手后接收FastCGI应答的超时时间。
fastcgi_buffer_size 254k; #指定读取FastCGI应答第一部分需要用多大的缓冲区
fastcgi_buffers 16 256k; #指定本地需要用多少和多大的缓冲区来缓冲FastCGI的应答。
fastcgi_busy_buffers_size 512k; #这个指令我也不知道是做什么用,只知道默认值是fastcgi_buffers的两倍。
fastcgi_temp_file_write_size 512k; #在写入fastcgi_temp_path时将用多大的数据块,默认值是fastcgi_buffers的两倍。
server {
listen 80 ; #监听端口号
#域名为
server_namelocalhost;
# 指定网站的目录
root /www/;
# localtion模块指定网站首页名称
location / {
index index.php index.html index.htm;
if (!-e $request_filename) {
return 444;
}
}
location ~ \.php$ {
root /www;
#fastcgi_cache MYAPP;
#fastcgi_cache_valid 200 60m;
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_indexindex.php;
fastcgi_cache_valid 200 60m;
fastcgi_paramSCRIPT_FILENAME$document_root$fastcgi_script_name;
include fastcgi_params;
}
location /zabbix{
alias /www/zabbix;
}
#指定对网页图片格式进行缓存max表示10年,也可以是30d(天)
location ~ \.(swf|js|css|xml|gif|jpg|jpeg|png|bmp)$ {
error_log off;
access_log off;
#expires 30d;
expires max;
}
}
}
页:
[1]