我在 kubuntu 上设置了一个带有 Apache/PHP/MySQL 的本地网络服务器,以使用 ZendSkeletonApplication 开发一个网络应用程序。文档根目录设置为 ZSA 的公用文件夹:
<VirtualHost *>
ServerName localhost
ServerAdmin webmaster@localhost
DocumentRoot "/var/www/ZendSkeletonApplication/public"
<Directory /var/www/ZendSkeletonApplication/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
LogLevel warn
CustomLog /var/log/apache2/access.log combined
ServerSignature On
</VirtualHost>
ZSA 的公共文件夹中有一个 .htaccess 文件,内容如下:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
请求http://localhost
正确检索index.php
. 此外, mod_rewrite 正在工作。我交换了最后一行
RewriteRule ^.*$ test.php [NC,L]
测试它并且它有效。
接下来,我编写了一个简单的“Hello World”模块来适应架构。实际上,我什至按照不同的教程编写了两个模块。但是每当我尝试请求时,http://localhost/helloworld
我都会收到 404 错误
The requested URL /helloworld was not found on this server.
我仔细检查了 ZF2 中的路线。
在这一点上,我被困住了。我是一名专业的 PHP 开发人员,对服务器管理知之甚少,因此我的设置很可能容易出错。
我想问一些方向,我可能做错了什么。有什么我可以检查的陷阱吗?我还需要提供什么信息?