在网上查了许多解决方法,下面是自己测试过能行的方法,只需在nginx.conf文件添加内容就可以了.
打开nginx.conf文件
<span style="color: #000000;"> ## Try the requested URI as files before handling it to PHP. location </span>/<span style="color: #000000;"> { #在这里添加下面内容 root那里修改成自己站点的目录 location </span>/<span style="color: #000000;"> { root F:</span><span style="color: #ff0000;">/</span>study<span style="color: #ff0000;">/</span>wnmp<span style="color: #ff0000;">/</span>html; <span style="color: #000000;"> index index.html index.htm; #访问路径的文件不存在则重写URL转交给ThinkPHP处理 </span><span style="color: #0000ff;">if</span> ( !-<span style="color: #000000;">e $request_filename ) { rewrite </span>^<span style="color: #ff0000;">/</span>(.*)$ <span style="color: #ff0000;">/</span>index.php<span style="color: #ff0000;">/</span>$1 last; <span style="color: #0000ff;">break</span><span style="color: #000000;">; } } location </span>~ \.php<span style="color: #ff0000;">/</span>?.*$ { root F:<span style="color: #ff0000;">/</span>study<span style="color: #ff0000;">/</span>wnmp<span style="color: #ff0000;">/</span>html; fastcgi_pass 127.0.0.1:9001<span style="color: #000000;">; fastcgi_index index.php; #加载Nginx默认</span><span style="color: #ff0000;">"服务器环境变量"</span><span style="color: #000000;">配置 include fastcgi_params; include fastcgi.conf; #设置PATH_INFO并改写SCRIPT_FILENAME,SCRIPT_NAME服务器环境变量 </span><span style="color: #0000ff;">set</span><span style="color: #000000;"> $fastcgi_script_name2 $fastcgi_script_name; </span><span style="color: #0000ff;">if</span> ( $fastcgi_script_name ~ <span style="color: #ff0000;">"^(.+\.php)(/.+)$"</span><span style="color: #000000;"> ) { </span><span style="color: #0000ff;">set</span> $fastcgi_script_name2 $1<span style="color: #000000;">; </span><span style="color: #0000ff;">set</span> $path_info $2<span style="color: #000000;">; } 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 </span>~* ^.+\.(jpg|jpeg|gif|png|bmp|css|js|<span style="color: #000000;">swf)$ { access_log off; root F:</span><span style="color: #ff0000;">/</span>study<span style="color: #ff0000;">/</span>wnmp<span style="color: #ff0000;">/</span>html; <span style="color: #0000ff;">break</span><span style="color: #000000;">; }</span>

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.
