【发布时间】:2013-12-21 19:49:38
【问题描述】:
我已经使用 Apache 从我的本地主机上传了一个 CodeIgniter 应用程序到运行 Nginx 的服务器。
它在我的本地主机和其他带有 Apache 的服务器上完美运行。
它在一个子域下,一个域和其他子域都在运行 PHP 100%。
CI 中的这个应用程序没有启动,PHP 没有被编译返回。
这是我在 /var/log/nginx/error.log 上得到的:
2013/12/05 14:50:31 [error] 20139#0: *1 FastCGI sent in stderr: "PHP message: PHP Fatal error: Class 'M_website' not found in /home/webroot/domain.com/cms/system/core/Loader.php on line 303" while reading upstream, client: 84.91.4.220, server: cms.domain.com, request: "GET /websites HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "cms.domain.com"
在 /home/webroot/domain.com/cms/system/core/Loader.php 中找不到类“M_website”
这是我的子域配置。
server
{
server_name cms.domain.com;
access_log /var/log/nginx/cms.domain.access.log;
root /home/webroot/domain.com/cms;
index index.php index.html index.htm;
if (!-e $request_filename) {
rewrite ^.*$ /index.php last;
}
# enforce NO www
if ($host ~* ^www\.(.*))
{
set $host_without_www $1;
rewrite ^/(.*)$ $scheme://$host_without_www/$1 permanent;
}
# canonicalize codeigniter url end points
# if your default controller is something other than "welcome" you should change the following
if ($request_uri ~* ^(/websites/(/index)?|/index(.php)?)/?$)
{
rewrite ^(.*)$ / permanent;
}
# removes trailing "index" from all controllers
if ($request_uri ~* index/?$)
{
rewrite ^/(.*)/index/?$ /$1 permanent;
}
# canonicalize codeigniter url end points
# if your default controller is something other than "welcome" you should change the following
if ($request_uri ~* ^(/websites/(/index)?|/index(.php)?)/?$)
{
rewrite ^(.*)$ / permanent;
}
# removes trailing "index" from all controllers
if ($request_uri ~* index/?$)
{
rewrite ^/(.*)/index/?$ /$1 permanent;
}
# removes trailing slashes (prevents SEO duplicate content issues)
if (!-d $request_filename)
{
rewrite ^/(.+)/$ /$1 permanent;
}
# removes access to "system" folder, also allows a "System.php" controller
if ($request_uri ~* ^/system)
{
rewrite ^/(.*)$ /index.php?/$1 last;
break;
}
# unless the request is for a valid file (image, js, css, etc.), send to bootstrap
if (!-e $request_filename)
{
rewrite ^/(.*)$ /index.php?/$1 last;
break;
}
# catch all
error_page 404 /index.php;
# use fastcgi for all php files
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
# deny access to apache .htaccess files
location ~ /\.ht
{
deny all;
}
}
【问题讨论】:
-
"PHP 没有编译就返回" --- 嗯,什么?
-
我看到源代码了! :( 如果我删除所有 CI 脚本等并在 index.php 中放置一个简单的 它可以工作......
-
您的子域configuration 在 Ngnix 上看起来如何?
-
tnks 用户 1190992。问题已更新。
-
我能够解决这个问题。 CI 文件以
标签: php codeigniter nginx