首页 > L.A.M.P > 最近做的一个 nginx 配置的备份

最近做的一个 nginx 配置的备份

2010年10月18日 发表评论 阅读评论

#设置 nginx 所属用户
user http;
#设置 nginx 运行的进程数
worker_processes  8;
worker_rlimit_nofile 10240;

events {
    #启用 epoll 优化网络
    use epoll;
    #设置最大连接数
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    #启用 sendfile 函数输出
    sendfile        on;
    #设置超时时间
    keepalive_timeout  65;

    #隐藏 nginx 版本号
    server_tokens off;

    #配置 GZIP
    gzip  on;
    gzip_min_length 1k;
    gzip_buffers 4 16k;
    gzip_http_version 1.1;
    gzip_comp_level 2;
    gzip_types text/plain application/x-javascript text/css application/xml;
    gzip_vary on;

    #配置数据缓冲以及文件缓存
    client_header_buffer_size 4k;
    client_max_body_size 8m;
    open_file_cache max=1024 inactive=20s;
    open_file_cache_valid 30s;
    open_file_cache_min_uses 1;

    #将默认站点指向到 /usr/html
    server {
        listen      80;
        server_name _;

        location / {
            root     /usr/html;
            index    index.html index.htm;
        }
    }

    #将服务器 8899 端口的所有访问指向到 phpMyAdmin
    server {
        listen      8899;
        server_name _;

        location / {
            root     /usr/html/phpmyadmin;
            index    index.html index.htm index.php;
        }

        #配置 PHP 解析
        location ~ \.php$ {
            root           /usr/html/phpmyadmin;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }
    }

    #调用其他虚拟空间独立配置文件
    include /etc/nginx/conf/vhost/*.conf;
}

分类: L.A.M.P 标签: ,
  1. 2010年10月21日13:59 | #1

    学习一下

  1. 本文目前尚无任何 trackbacks 和 pingbacks.