新项目使用的dolphinphp框架
dolphinphp框架设置了index.php前端入口文件个admin.php后台入口文件
在nginx服务器上各种坑!
首先dolphinphp框架要求服务器支持pathinfo模式
原本nginx配置如下:
server {
listen 80;
server_name xxxxxx.com;
index index.html index.htm index.php;
root /alidata/www/xxxx;
location ~ .*\.(php|php5)?$
{
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 1h;
}
#α¾²Ì¬¹æÔò
include /alidata/server/nginx/conf/rewrite/xxxx.conf;
access_log /alidata/log/nginx/access/xxxx.log;
}
开启pathinfo则需要把
这部分改为:
location ~ \.php //去掉$符号 这地方没注意结果一直404 一把辛酸泪啊
{
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
//添加pathinfo
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi.conf;
}
好了,到此为止pathinfo就配置好了
接下来配置rewrite
if (!-e $request_filename) {
//添加admin.php入口文件
rewrite /admin.php(.*)$ /admin.php$1 last;
rewrite ^(.*)$ /?s=$1
break;
}
最后重启nginx
service nginx restart
好了 ,到此为止dolphinphp框架的服务器端就算配置完毕了,最后还是得吐槽下,好坑啊!!!!