我在本地服务器(ubuntu)上部署了一个zend应用程序,默认页面正常工作,但应用程序的其余部分都抛出404找不到页面。在Bootsrap部署zend应用程序后的404
我的index.php
// Define path to application directory defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
// Define application environment defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
// Ensure library/ is on include_path set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library'),
get_include_path(),)));
/** Zend_Application */ require_once 'Zend/Application.php';
// Create application, bootstrap, and run $application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'); $application->bootstrap()
->run();
的application.ini
[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
resources.frontController.params.displayExceptions = 0
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.modules = ""
resources.frontController.params.prefixDefaultModule = "1"
resources.db.adapter = mysqli
resources.db.params.host = localhost
resources.db.params.username = root
resources.db.params.password = ""
resources.db.params.dbname = assalam
[staging : production]
[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1
_initAutoLoader函数文件
protected function _initAutoLoad(){
$modelLoader = new Zend_Application_Module_Autoloader(array(
'namespace'=>'',
'basePath'=>APPLICATION_PATH . '/modules/default'
));
if(Zend_Auth::getInstance()->hasIdentity()){
Zend_Registry::set('role',Zend_Auth::getInstance()->getStorage()->read()->role);
}else {
Zend_Registry::set('role','Visiteurs');
}
$this->_acl = new Model_UsersAcls();
$this->_auth = Zend_Auth::getInstance();
$fc = Zend_Controller_Front::getInstance();
$fc->registerPlugin(new Plugin_AccessCheck($this->_acl));
return $modelLoader;
}
的apache2.conf包含
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
htaccess的文件包含
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::\2$
RewriteRule ^(.*)$ - [E=BASE:%1]
RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L]
虚拟主机代码
<VirtualHost *:80>
ServerName localhost
DocumentRoot /var/www/
<Directory /var/www/>
Options +FollowSymlinks +SymLinksIfOwnerMatch
AllowOverride All
</Directory>
</VirtualHost>
这是我的.htaccess RewriteEngine叙述在 的RewriteCond%{} REQUEST_FILENAME -s [OR] 的RewriteCond%{} REQUEST_FILENAME -l [OR] 的RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^。* $ - [NC,L] RewriteCond%{REQUEST_URI} :: $ 1 ^(/.+)(。+):: \ 2 $ RewriteRule ^(。*)$ - [E = BASE:%1] RewriteRule ^(。*)$%{ENV:BASE} index.php [NC,L] – user3166336
我做了它,但现在我无法访问公共文件夹,它不可见,并出现内部服务器错误页面 – user3166336
我把我的一个htaccess文件的例子在这里供您比较。 – Elie