在Apache Server中的Codeigniter上获取503服务不可用



我在Apache服务器(XAMPP(上使用Codeigniter 3,我的实时服务器(CentOS(出现问题。当我尝试加载新视图时,不会出现任何问题。但是,当我试图在旧视图加载完成之前多次(如5次(加载新视图时,服务器会崩溃,并给我一个503错误。

当用户尝试使用导航菜单,发现页面加载缓慢时,我们发现了这个错误,因为数据库速度较慢,他很快就尝试加载新页面。

此错误发生在所有视图中,无论它们多么简单或复杂。

下面是一个生成错误的视图示例。

<?php
defined('BASEPATH') or exit('No direct script access allowed');
class Example_controller extends CI_Controller
{
public function __construct()
{
parent::__construct();
$this->load->model('example_model');
$this->load->helper('form');
$this->load->library('form_validation');
$this->load->library('session');
$this->load->helper('url');
}
public function index()
{
$data['information'] = $this->example_model->get_data();
$this->load->view('header');
$this->load->view('body', $data);
$this->load->view('footer');
}
}

在本例中,数据库函数是一个非常简单的Select查询。我使用的是Oracle SQL数据库。

我还试图更改.htaccess文件,以便有更多的时间让服务器超时,但没有成功。

这是我当前的.htaccess文件:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

我一直在寻找答案很长时间了,我将非常感谢你能给我的任何帮助。提前谢谢。

我认为您不能使用CI提供的重定向((函数来设置503 HTTP状态。但是您可以设置301代码(临时重定向(,这意味着搜索引擎将知道您的页面是临时重定向的,并且不会对维护页面进行索引。

更多信息点击这里

最新更新