nginx配置⽂件注释解释
#user nobody;
#nginx进程数,建议设置为等于cpu总核⼼数
worker_processes 1;
#全局错误⽇志定义类型,'[ debug | info | notice | warn | error | crit ]'
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#进程⽂件
#pid logs/nginx.pid;
#⼀个nginx进程打开的最多⽂件描述符数⽬,理论值应该是最多打开⽂件数(系统的值ulimit -n)与nginx进程数相除,但是nginx分配请求并不均匀,所以建议与ulimit #work_rlimit_nofile '65535;'
#⼯作模式与连接数上限
events {
#参考事件模型,'use [ kqueue | rtsig | epoll | /dev/poll | select | poll ]; epoll模型是Linux 2.6以上版本内核中的⾼性能⽹络I/O模型,如果跑在FreeBSD上⾯,就⽤kq #'use epoll;'
#单个进程最⼤连接数(最⼤连接数=连接数*进程数)
worker_connections 1024;
}
#设定http服务器
http {
#⽂件扩展名与⽂件类型映射表
include pes;
#默认⽂件类型
default_type application/octet-stream;
#默认编码
#charset 'utf-8; '
#服务器名字的hash表⼤⼩
#'server_names_hash_bucket_size 128;'
#上传⽂件⼤⼩限制
#'client_header_buffer_size 32k;'
#设定请求缓
#'large_client_header_buffers 4 64k;'
#设定请求缓
#'client_max_body_size 8m; '
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
#开启⾼效⽂件传输模式,sendfile指令指定nginx是否调⽤sendfile函数来输出⽂件,对于普通应⽤设为on,
#如果⽤来进⾏下载等应⽤磁盘IO重负载应⽤,可设置为off,以平衡磁盘与⽹络I/O处理速度,降低系统的负载。
#注意:如果图⽚显⽰不正常把这个改为off
sendfile on;
#防⽌⽹络阻塞
#tcp_nopush on;
#防⽌⽹络阻塞
#'tcp_nodelay on';
#长连接超时时间,单位是秒
#keepalive_timeout 0;
keepalive_timeout 65;
#FastCGI相关参数是为了改善⽹站的性能:减少资源占⽤,提⾼访问速度
#astcgi_connect_timeout 300;
#fastcgi_send_timeout 300;
#fastcgi_send_timeout 300;
#fastcgi_read_timeout 300;
#fastcgi_buffer_size 64k;
#fastcgi_buffers 4 64k;
#fastcgi_busy_buffers_size 128k;
#fastcgi_temp_file_write_size 128k;
#gzip模块设置
#开启gzip压缩输出
#gzip on;
#最⼩压缩⽂件⼤⼩
#gzip_min_length 1k;
#压缩缓冲区
#gzip_buffers 4 16k;
#压缩版本(默认1.1,前端如果是squid2.5请使⽤1.0)
#gzip_http_version 1.0;
#压缩等级
#gzip_comp_level 2;
#gzip_types text/plain application/x-javascript text/css application/xml;
#压缩类型,默认就已经包含text/html,所以下⾯就不⽤再写了,写上去也不会有问题,但是会有⼀个warn。 #gzip_vary on;
#开启限制IP连接数的时候需要使⽤
#limit_zone crawler $binary_remote_addr 10m;
#upstream blog.ha97 {
#upstream的负载均衡,weight是权重,可以根据机器配置定义权重。weigth参数表⽰权值,
#权值越⾼被分配到的⼏率越⼤。
#server 192.168.80.121:80 weight=3;
#server 192.168.80.122:80 weight=2;
#server 192.168.80.123:80 weight=3;
#}
#虚拟主机的配置
server {
#监听端⼝
listen 80;
#域名可以有多个,⽤空格隔开
#server_name end
server_name localhost;
#server_name www.fanbin;
# 访问域名跟⽬录
#root /home/wwwroot/aa/web$subdomain;
#载⼊其他配置⽂件
#rewrite end
#include f;
# 绑定⽬录为⼆级域名 bbb.aa 根⽬录 /bbb ⽂件夹
#set $subdomain '';
#charset koi8-r;
#定义本虚拟主机的访问⽇志
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass 127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration #
#server {
# listen 8000;
# listen somename:8080;
nginx 配置文件# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
#} }
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论