我们来说下mac上通过MxSrvs支持ThinkPHP3.2伪静态,首先我们要打开的是该项目的配置文件,不是nginx的配置文件:
点击左侧的配置编辑,然后点击Nginx右侧的小箭头,然后点击下面的vhosts左侧的小箭头,然后从右侧的列表选择你的项目。
修改配置文件:
server {
listen 80;
server_name devapi.sunxiaoning.com;
root /Users/zero/projects/舒尔特方格/shuerte/api/shuerte_api;
#access_log /Applications/MxSrvs/logs/shuerte_api.log;
include vhosts/_nginx.vhost.fpm;
# 加入以下内容
location /
{
index index.php;
#ThinkPHP REWRITE支持
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?s=$1 last;
break;
}
}
}
然后修改nginx的配置文件
location ~ \.php$ {
root /Applications/MxSrvs/www;
fastcgi_pass 127.0.0.1:10080;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_split_path_info ^(.+\.php)(.*)$; #增加这一句
fastcgi_param PATH_INFO $fastcgi_path_info; #增加这一句
include fastcgi_params;
}