设为首页 加入收藏

TOP

WNMP集成环境下配置thinkPHP
2017-10-10 11:57:31 】 浏览:5850
Tags:WNMP 集成 环境 配置 thinkPHP

在网上查了许多解决方法,下面是自己测试过能行的方法,只需在nginx.conf文件添加内容就可以了.

打开nginx.conf文件

   ## Try the requested URI as files before handling it to PHP.
    location / {

#在这里添加下面内容 root那里修改成自己站点的目录
location / {
            root   F:/study/wnmp/html;
            index  index.html index.htm;
            #访问路径的文件不存在则重写URL转交给ThinkPHP处理
            if ( !-e $request_filename ) {
               rewrite  ^/(.*)$  /index.php/$1  last;
               break;
            }
        }
location ~ \.php/?.*$ {
            root        F:/study/wnmp/html;
            fastcgi_pass   127.0.0.1:9001;
            fastcgi_index  index.php;
            #加载Nginx默认"服务器环境变量"配置
            include        fastcgi_params;
            include           fastcgi.conf;
            #设置PATH_INFO并改写SCRIPT_FILENAME,SCRIPT_NAME服务器环境变量
            set $fastcgi_script_name2 $fastcgi_script_name;
            if ( $fastcgi_script_name ~ "^(.+\.php)(/.+)$" ) {
                set $fastcgi_script_name2 $1;
                set $path_info $2;
            }
            fastcgi_param   PATH_INFO $path_info;
            fastcgi_param   SCRIPT_FILENAME   $document_root$fastcgi_script_name2;
            fastcgi_param   SCRIPT_NAME   $fastcgi_script_name2;
        }

#最后这部分是为了css和js 以及图片等资源
location ~* ^.+\.(jpg|jpeg|gif|png|bmp|css|js|swf)$ {
            access_log off;
            root F:/study/wnmp/html;
            break;
        }

 

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇PHP 源码学习之线程安全 下一篇PHP的mysqli_query参数MYSQLI_STO..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目