Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1841640
  • 博文数量: 117
  • 博客积分: 2559
  • 博客等级: 少校
  • 技术积分: 4385
  • 用 户 组: 普通用户
  • 注册时间: 2010-08-13 20:08
个人简介

作为初学者,要想取得进步,成为高手,首先应该了解自己的不足之处.

文章分类

全部博文(117)

文章存档

2014年(1)

2013年(25)

2012年(13)

2011年(77)

2010年(1)

分类: 系统运维

2011-05-12 18:04:46

配置文件(说明

user  nginx;nginx的运行账号(rpm安装时会自动创建这个账号),也可以写成user nginx nginx表示用户和组

worker_processes  10;工作进程数(worker),一般等于cpu内核数或者两倍

worker_rlimit_nofile 100000;文件描述符数量

 

error_log   /var/log/nginx/error.log;

#error_log  /var/log/nginx/error.log  notice;

#error_log  /var/log/nginx/error.log  info;

 

pid        /var/run/nginx.pid;

 

 

events {

    worker_connections  1024;每个worker进程允许的连接数

    use epoll;网络I/O事件模型,linux推荐用epoll,FreeBSD推荐用kqueue

}

 

 

http {

    include       /etc/nginx/mime.types;include用来引用其他的配置文件,即可以按照需求将不同的配置写到不同的文件里面

    default_type  application/octet-stream;

 

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '

                      '$status $body_bytes_sent "$http_referer" '

                      '"$http_user_agent" "$http_x_forwarded_for"';

定义日志格式,格式名字设为main

    access_log  /var/log/nginx/access.log  main;

access日志文件的路径,采用上面定义的main 格式记录

    sendfile        on;

    tcp_nopush      on;

    tcp_nodelay     on;

    server_tokens   off;

    gzip            on;启用压缩

    gzip_static     on;启用HTTPGzipStatic模块(不在corestandard模块组中,rpm安装带了此模块)

    gzip_comp_level 5;压缩级别,1最小最快,9最大最慢

    gzip_min_length 1024;压缩的最小长度,小于此长度的不压缩(此长度即header中的Content-Length)

    keepalive_timeout  65;

    limit_zone   myzone  $binary_remote_addr  10m;

 

    # Load config files from the /etc/nginx/conf.d directory

    include /etc/nginx/conf.d/*.conf;

 

    server {

        limit_conn   myzone  10;

        listen       80;端口

        server_name  _;域名

 

        #charset koi8-r;

 

        #access_log  logs/host.access.log  main;

 

        location / {

            root   /usr/share/nginx/html;主目录

            index  index.html index.htm;

        }

………………

阅读(16790) | 评论(0) | 转发(0) |
0

上一篇:Nginx安装

下一篇:cacti使用OpenLDAP认证

给主人留下些什么吧!~~