首页 > 代码库 > nginx 配置

nginx 配置

server {

    listen       8080;

    server_name  localhost;

    root         /Applications/thinkphp/;

 

    location ~ \.php {

        root /Applications/thinkphp/;

        fastcgi_pass 127.0.0.1:9000;

        include   fastcgi.conf;

        set $path_info "";

        set $fastcgi_script_name_new $fastcgi_script_name;

    

        if ($fastcgi_script_name ~*   "^(.+\.php)(/.+)$"  ) {

        set $fastcgi_script_name_new $1;

        set $path_info $2;

        }

    

        fastcgi_param   SCRIPT_FILENAME   $document_root$fastcgi_script_name_new;

        fastcgi_param   SCRIPT_NAME   $fastcgi_script_name_new;

        fastcgi_param   PATH_INFO $path_info;

    }

 

    location / {

        index  index.html index.htm index.php;

        include     /usr/local/etc/nginx/conf.d/php-fpm;

        if (!-e  $request_filename){

              rewrite ^(.*)$ /index.php$1 last;

        }

    }

}

nginx 配置