使用CodeIgniter开发所遇到的问题
CodeIgniter与nginx搭配
CodeIgniter与nginx配合时,经常会遇到这两个错误提示:
File not found No input file specified
这个错误跟path_info有关,需要在nginx中对应的站点配置中做简单配置。下面我把我的一个站点配置贴出来供参考:
server { listen 80; server_name services.xx.com; server_name_in_redirect off; root /data/web/xx/services; index index.php index.htm index.html; error_log /data/log/xx/web_common/error.log ; access_log /data/log/xx/web_common/access.log main; location / { index index.php index.html; } if (!-e $request_filename) { rewrite ^/(.*)$ /index.php/$1 last; break; } location ~ .*\.(svn|git|cvs) { deny all; } location ~* \.(htm|html|xml|shtml)$ { expires 600; } location ~* \.(js|css|htc|gif|ico|png|swf|jpg|jpeg|bmp)$ { expires 365d; } location ~* \.(bak|tar|gz|zip|tgz|sql)$ { return 403; } location ~ .*.php($|/) { fastcgi_split_path_info ^(.+\.php)(.*)$; fastcgi_param PATH_INFO $fastcgi_path_info; include php_fastcgi_params; fastcgi_pass unix:/tmp/php-fpm.sock; fastcgi_index index.php; } }
特别注意最后一个配置中的 fastcgi_split_path_info和 fastcgi_param PATH_INFO以及 location ~ .*.php($|/)。仔细对比自己的配置和我的配置吧。
对于有子站点的情况,比如我的CI目录结构是这样的:
---- application |---- api |---- wechat---- system---- logs……
application目录下放各个子站点,并通过同一个二级域名访问,假设是 apps.xx.com,那么各个子站点的访问链接为:
http://apps.xx.com/apihttp://apps.xx.com/wechat
那么,apps这个二级域名对应的配置为:
server { listen 80; server_name apps.xx.com; server_name_in_redirect off; root /data/web/xx/application; index index.php index.htm index.html; error_log /data/log/xx/web_common/error.log ; access_log /data/log/xx/web_common/access.log main; location / { index index.php index.html; } location /api { index index.php index.html; if ( !-e $request_filename ) { rewrite ^/api/(.+)$ /api/index.php/$1 last; break; } } location /wechat { index index.php index.html; if ( !-e $request_filename ) { rewrite ^/wechat/(.+)$ /wechat/index.php/$1 last; break; } } location ~ .*\.(svn|git|cvs) { deny all; } location ~* \.(htm|html|xml|shtml)$ { expires 600; } location ~* \.(js|css|htc|gif|ico|png|swf|jpg|jpeg|bmp)$ { expires 365d; } location ~* \.(bak|tar|gz|zip|tgz|sql)$ { return 403; } location ~ .*.php($|/) { fastcgi_split_path_info ^(.+\.php)(.*)$; fastcgi_param PATH_INFO $fastcgi_path_info; include php_fastcgi_params; fastcgi_pass unix:/tmp/php-fpm.sock; fastcgi_index index.php; } }
注意各个子站点的配置。

热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

AI Hentai Generator
免费生成ai无尽的。

热门文章

热工具

记事本++7.3.1
好用且免费的代码编辑器

SublimeText3汉化版
中文版,非常好用

禅工作室 13.0.1
功能强大的PHP集成开发环境

Dreamweaver CS6
视觉化网页开发工具

SublimeText3 Mac版
神级代码编辑软件(SublimeText3)

长URL(通常用关键字和跟踪参数都混乱)可以阻止访问者。 URL缩短脚本提供了解决方案,创建了简洁的链接,非常适合社交媒体和其他平台。 这些脚本对于单个网站很有价值

在Facebook在2012年通过Facebook备受瞩目的收购之后,Instagram采用了两套API供第三方使用。这些是Instagram Graph API和Instagram Basic Display API。作为开发人员建立一个需要信息的应用程序

Laravel使用其直观的闪存方法简化了处理临时会话数据。这非常适合在您的应用程序中显示简短的消息,警报或通知。 默认情况下,数据仅针对后续请求: $请求 -

这是有关用Laravel后端构建React应用程序的系列的第二个也是最后一部分。在该系列的第一部分中,我们使用Laravel为基本的产品上市应用程序创建了一个RESTFUL API。在本教程中,我们将成为开发人员

Laravel 提供简洁的 HTTP 响应模拟语法,简化了 HTTP 交互测试。这种方法显着减少了代码冗余,同时使您的测试模拟更直观。 基本实现提供了多种响应类型快捷方式: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

PHP客户端URL(curl)扩展是开发人员的强大工具,可以与远程服务器和REST API无缝交互。通过利用Libcurl(备受尊敬的多协议文件传输库),PHP curl促进了有效的执行

您是否想为客户最紧迫的问题提供实时的即时解决方案? 实时聊天使您可以与客户进行实时对话,并立即解决他们的问题。它允许您为您的自定义提供更快的服务

2025年的PHP景观调查调查了当前的PHP发展趋势。 它探讨了框架用法,部署方法和挑战,旨在为开发人员和企业提供见解。 该调查预计现代PHP Versio的增长
