很早就听说了鸟哥的yaf,最近想搭一个试用研究下
但是访问遇到了一些问题:
是在lnmp环境,nginx配置是
root /www/web/root;
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php/$1 last;
}
我直接访问domain.com/mainweb没问题,能访问到默认control index,
但是我访问domain.com/mainweb/index/index 确是500,然后nginx错误日志是rewrite or internal redirection cycle while processing /index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/mainweb/index/index
访问 index control中的其他action 也是500错误
回复讨论(解决方案) 对比一下有什么不同 server { listen 80; server_name www.phpno.com; root /home/www/www_phpno_com/admin_wwwroot; access_log off; error_page 404 /404.html; location /404.html { root /home/www/www_phpno_com/admin_wwwroot; } location /{ index index.html index.htm index.php; if (-e $request_filename) { break; } if (!-e $request_filename) { rewrite ^/(.*)$ /index.php/$1 last; break; } } location ~ .+\.php($|/) { root /home/www/www_phpno_com/admin_wwwroot; fastcgi_index index.php; fastcgi_split_path_info ^(.+\.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; fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param script_filename /home/www/www_phpno_com/admin_wwwroot/$fastcgi_script_name; # fastcgi_param script_filename /usr/local/nginx/html/$fastcgi_script_name; include fastcgi_params; } }
感谢楼上,
我发现我只要配置fastcgi的location ~ .*\.(php|php5)?$ 改为你的location ~ .+\.php($|/)
就全解决了
下面是我的facgi param:
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param script_filename $document_root$fastcgi_script_name;
fastcgi_param query_string $query_string;
fastcgi_param request_method $request_method;
fastcgi_param content_type $content_type;
fastcgi_param content_length $content_length;
fastcgi_param script_name $fastcgi_script_name;
fastcgi_param request_uri $request_uri;
fastcgi_param document_uri $document_uri;
fastcgi_param document_root $document_root;
fastcgi_param server_protocol $server_protocol;
fastcgi_param gateway_interface cgi/1.1;
fastcgi_param server_software nginx/$nginx_version;
fastcgi_param remote_addr $remote_addr;
fastcgi_param remote_port $remote_port;
fastcgi_param server_addr $server_addr;
fastcgi_param server_port $server_port;
fastcgi_param server_name $server_name;
# php only, required if php was built with --enable-force-cgi-redirect
fastcgi_param redirect_status 200