Environment

Operating system: CentOS Version: 5 Update on 2 years ago
nginx.conf(nginx主配置) Raw Download

user  ninjacn;
worker_processes  2;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       /etc/nginx/mime.types;
    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"';

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

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    client_max_body_size 10m;
    client_header_buffer_size 4k;
    client_body_buffer_size 5m;
    large_client_header_buffers 4 64k;

    charset utf-8;
    proxy_set_header Host $host;
    proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
    #proxy_connect_timeout 10;
    #proxy_read_timeout 30;
    #proxy_send_timeout 30;
    proxy_buffer_size        16k;
    proxy_buffers            4 64k;
    proxy_busy_buffers_size 128k;
    proxy_temp_file_write_size 128k;

    gzip  on;
    gzip_comp_level 9;
    gzip_disable "MSIE [1-6]\.";
    gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/javascript;

    include /etc/nginx/conf.d/*.conf;
}
fastcgi.conf(fastcgi配置) Raw Download

fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
fastcgi_param  QUERY_STRING       $query_string;
fastcgi_param  REQUEST_METHOD     $request_method;
fastcgi_param  CONTENT_TYPE       $content_type;
fastcgi_param  CONTENT_LENGTH     $content_length;

fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
fastcgi_param  REQUEST_URI        $request_uri;
fastcgi_param  DOCUMENT_URI       $document_uri;
fastcgi_param  DOCUMENT_ROOT      $document_root;
fastcgi_param  SERVER_PROTOCOL    $server_protocol;
fastcgi_param  HTTPS              $https if_not_empty;

fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;

fastcgi_param  REMOTE_ADDR        $remote_addr;
fastcgi_param  REMOTE_PORT        $remote_port;
fastcgi_param  SERVER_ADDR        $server_addr;
fastcgi_param  SERVER_PORT        $server_port;
fastcgi_param  SERVER_NAME        $server_name;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param  REDIRECT_STATUS    200;
linuxnotes.cn.conf(linuxnotes.cn域配置) Raw Download
server {
    listen 80;
    server_name linuxnotes.cn;

    root /www/linuxnotes/frontend/web/;
    index index.php index.html;

    access_log  /var/log/nginx/linuxnotes.cn.log;
    error_log   /var/log/nginx/linuxnotes.cn.err;

    location ~* \.(css|js|ico|jpg|gif|png|jpeg|txt)$ {
        expires 24h;
    }


    location ~ \.php$ {
        fastcgi_pass   unix:/var/run/php5-fpm.sock;
        fastcgi_index  index.php;
        include        fastcgi.conf;
        try_files $uri =404;
    }

    location / {
        try_files $uri $uri/ /index.php?$args;
    }
    location ~ /\.(ht|svn|git) {
        deny all;
    }
}