1. 程式人生 > >nginx 配置 server

nginx 配置 server

stc cgi off evel ast ati autoindex index fastcgi

server{
    listen          80;
    server_name     test.eoews.cn;
    #項目文件的路徑
    root    "D:/developer/study/PHPTutorial/WWW/project/eoews";
    #默認尋找打開文件
    location / {
        #默認打開的文件
        index index.html index.htm index.php l.php;
        #打開目錄瀏覽功能
        autoindex   off;
        #重寫機制
        if (!-e $request_filename) {
                rewrite  ^/(.*)$  /index.php/$1  last;
                break;
        }
    }
    #將服務器錯誤重定向到指定的靜態頁面中
    error_page  500 502 503 504 D:/developer/study/PHPTutorial/nginx/html/50x.html;

    location = /50x.html {
        root D:/developer/study/PHPTutorial/nginx/html;
    }

    location ~ \.php(.*)$ {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_split_path_info  ^((?U).+\.php)(/?.+)$;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        fastcgi_param  PATH_INFO  $fastcgi_path_info;
        fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;
        include        fastcgi_params;
    }
}

 

nginx 配置 server