phpStudy+nginx配置laravel伪静态
简介
phpStudy+nginx配置laravel伪静态
之前一直用宝塔配置环境,但是,最近宝塔win版本的停止更新了,只能用回phpstudy了,
记录一下配置伪静态
1:点击创建站点的时候,进行伪静态配置
在伪静态输入框中输入如下代码,并点击保存
# Check if a file exists, or route it to index.php.
try_files $uri $uri/ /exploit/index.php?$query_string;
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
打开相应的配置文件,我现在配置的是localhost_80.conf
打开相应的站点跟目录可以看到在public下面会有个nginx.htaccess文件
server {
listen 80;
server_name dev.test.net;
root "E:/wwwroot/xxxx/public";
location / {
index index.php index.html error/index.html;
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
break;
}
autoindex off;
}
location ~ \.php(.*)$ {
fastcgi_pass 127.0.0.1:9001;
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查看效果
配置完成!