设置方法两步:
一、vhosts中
****.conf 内容如下:
server {
listen 80;
server_name youurl.com;
index index.html index.htm index.php;
root /yourpath/;
location ~ .*\.(php|php5)?$
{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$; #
fastcgi_param PATH_INFO $fastcgi_path_info; #
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location / {
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
break;
}
}
access_log /www/log/nginx/access/test.log;
}设置完后,重启服务:nginx -s reload;二、修改文件 core\library\think\Url.php
第131行处:
$url = $domain . (self::$root ?: Request::instance()->root()) . '/' . ltrim($url, '/');
改为: $url = $domain . '/' . ltrim($url, '/');
清理缓存,刷新页面,查看生成地址,为pathinfo模式。
如果有好的办法,欢迎指出。
最佳答案