学海无涯
go,go,go

记录生产nginx配置文件

nginx.conf配置文件

user  www www;

worker_processes     8;
worker_cpu_affinity 00000001 00000010 00000100 00001000 00010000 00100000 01000000 10000000;
error_log  /usr/local/nginx/logs/nginx_error.log  info;
worker_rlimit_nofile 65535;
worker_priority -20;

pid        /usr/local/nginx/logs/nginx.pid;

events
    {
        use epoll;
        worker_connections 65535;
        multi_accept on;
    }

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

        server_names_hash_bucket_size 128;
        client_header_buffer_size 32k;
        large_client_header_buffers 4 32k;
        client_max_body_size 110m;
        fastcgi_intercept_errors on;
        fastcgi_connect_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 256k;

        sendfile   on;
        tcp_nopush on;

        keepalive_timeout 60;

        tcp_nodelay on;
        open_file_cache max=102400 inactive=20s;
	open_file_cache_valid 30s;
	open_file_cache_min_uses 1;
        #Gzip Compression
        gzip on;
        gzip_buffers 16 8k;
        gzip_comp_level 6;
        gzip_http_version 1.0;
        gzip_min_length 256;
        gzip_proxied any;
        gzip_vary on;
        gzip_types
        text/xml application/xml application/atom+xml application/rss+xml application/xhtml+xml image/svg+xml
        text/javascript application/javascript application/x-javascript
        text/x-json application/json application/x-web-app-manifest+json
        text/css text/plain text/x-component
        font/opentype application/x-font-ttf application/vnd.ms-fontobject
        image/x-icon;
        gzip_disable "MSIE [1-6]\.(?!.*SV1)";
		

        
        #limit_conn_zone $binary_remote_addr zone=perip:10m;
        ##If enable limit_conn_zone,add "limit_conn perip 10;" to server section.

        log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                          '$status $body_bytes_sent "$http_referer" '
                          '"$http_user_agent" "$http_x_forwarded_for" 客户时间:"$request_time" 服务器时间:"$upstream_response_time" ';

        server_tokens off;
        access_log /usr/local/nginx/logs/nginx-access.log;
        include vhost/*.conf;
        }

站点配置kitchen.conf

server {
            listen 80;
            server_name www.xxx.cn;  
            root /data/www/cook_monitoring_lianjiang;
            index  index.aspx index.shtml index.html;
            access_log  /usr/local/nginx/logs/tmcf-wx-lianjiang-gov-cn.log main;
            error_log   /usr/local/nginx/logs/tmcf-wx-lianjiang-gov-cn-error.log   error;  
            location ~ .*\.(php|php5)?$ {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            include       fastcgi.conf;
        }
        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
              expires 30d;
              access_log off;
        }
       location ~ .*\.(js|css)?$ {
           expires 7d;
           access_log off;
       }
}


server {
        listen 80;
        server_name www.xxxx.cn;
        index index.htm index.aspx index.shtml index.html;
        root /data/www/cook_monitoring_lianjiang_mp/public;
        access_log  /usr/local/nginx/logs/tmcf-lianjiang-gov-cn.log main;
        error_log    /usr/local/nginx/logs/tmcf-lianjiang-gov-cn-error.log   error;
        location ~ .*\.(php|php5)?$ {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            include       fastcgi.conf;
        }
        location / {
        if (!-e $request_filename) {
            rewrite ^(.*)$ /index.php?s=/$1 last;
            break;
        }
        }
       location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
              expires 30d;
              access_log off;
        }
       location ~ .*\.(js|css)?$ {
           expires 7d;
           access_log off;
       }
}
赞(0) 打赏
未经允许不得转载:YYQ运维技术博客_运维的工作学习之路 » 记录生产nginx配置文件
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

运维devops

联系我们关于本博客

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏