首页 > 代码库 > nginx配置摘要

nginx配置摘要

nginx.conf:

http {

    include       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  logs/access.log  main;


    sendfile        on;

    #tcp_nopush     on;


    #keepalive_timeout  0;

    keepalive_timeout  65;

client_max_body_size 10M;


    #gzip  on;


    #加载配置顺序 靠前采用域名地址   

    #include       d:/wnmp/nginx-1.4.3/conf/vhost/test.conf;

#include       d:/wnmp/nginx-1.4.3/conf/vhost/ci.conf;

include       D:/wnmp/nginx-1.4.3/conf/vhost/*.conf;

}

vhost文件夹下的一个服务器配置

    server {

        listen       80;

        server_name  tczsslocal.com;


        location / {

            root   d:/wnmp/tczsslocal;

            index  index.php index.html index.htm;

if ( -d $request_filename){

rewrite ^/(.*)([^/])$ http://$host/$1$2/ permanent;

}

if ( !-e $request_filename){

rewrite ^/(.*) /?v=$1 break;

}


        }


        error_page   500 502 503 504  /50x.html;

        location = /50x.html {

            root   html;

        }


        location ~ \.php$ {

root   d:/wnmp/tczsslocal;

            fastcgi_pass   127.0.0.1:9000;

            fastcgi_index  index.php;

            fastcgi_param  SCRIPT_FILENAME  d:/wnmp/tczsslocal$fastcgi_script_name;

            include        fastcgi_params;

include   d:/wnmp/nginx-1.4.3/conf/fastcgi.conf;

        }


    }


nginx配置摘要