对 Zend Server 配置感到困惑

发布于 2024-10-17 18:48:30 字数 745 浏览 4 评论 0原文

我已经安装了 Zend 服务器并开发了一个示例应用程序,当我的应用程序 url 无法在浏览器中打开时,我感到很惊讶...

这是我的 url,与我的 zend 应用程序相关:

http://localhost/app_name/public /controller/action/parameter

我收到如下错误:“在此服务器上找不到请求的 URL /app_name/public/controller/action/parameter”。

当我从此处阅读快速入门指南时,我了解到我必须在 Apache 目录的 httpd.conf 文件中定义一个 VirtualHost 指令。

但令我惊讶的是,我发现我的 httpd.conf 文件中已存在以下几行:

DocumentRoot "C:\zend\Apache2/htdocs"

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

无法理解要做什么...

I have installed Zend server and developed a sample application, and iam surprised when my application url could not open in the browser...

This is my url, related to my zend application:

http://localhost/app_name/public/controller/action/parameter

I got an error like: "The requested URL /app_name/public/controller/action/parameter was not found on this server".

When i read the quickstart guide from here, i learnt that i had to define a VirtualHost directive inside my httpd.conf file of Apache directory.

But to my surprise, i found the following lines already existing in my httpd.conf file:

DocumentRoot "C:\zend\Apache2/htdocs"

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

Could not understand what to do...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

陌路终见情 2024-10-24 18:48:30

首先,您的文档根目录是错误的。您同时使用正斜杠和反斜杠,访问本地主机将带您访问 htdocs 而不是虚拟主机。

请按照以下步骤创建虚拟主机或使用这些

  1. 创建虚拟主机

检查您的设置

 <虚拟主机 *:80>
    服务器名称 cert.local
    DocumentRoot“C:/Program Files (x86)/Apache Software Foundation/Apache2.2/cert/public”
    <目录“C:/Program Files (x86)/Apache Software Foundation/Apache2.2/cert/public”>
        目录索引index.php
        允许覆盖全部
        订单允许、拒绝
        允许所有
    

  1. 注册您的操作系统(适用于 Windows)

    转到 c:\WINDOWS\system32\drivers\etc 并添加以下行

    127.0.0.1 cert.local

  2. 重新启动apache 服务器,为了访问虚拟主机,请转到 http://cert.local/

如果您想访问htdocs 和 zend 同时存在,那么您必须创建另一个指向 htdocs 的虚拟主机。

以下是有关虚拟主机的一些基本知识

http://httpd.apache.org/docs/2.2/vhosts /

希望这会有所帮助..:)

First of all , your document root was wrong.You are using forward and backward slash at the same time and accessing the localhost will take you to the htdocs not the virtual host.

Please follow these steps to create a virtual host or check your setting with these

  1. Create a virtual hosts
  <VirtualHost *:80>
    ServerName cert.local
    DocumentRoot "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/cert/public"
    <Directory "C:/Program Files (x86)/Apache Software Foundation/Apache2.2/cert/public">
        DirectoryIndex index.php
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>
  1. Register with your operating system (for windows)

    Go to c:\WINDOWS\system32\drivers\etc and add the following line

    127.0.0.1 cert.local

  2. Restart the apache server and in order to access the virtual host go to http://cert.local/

If you want to access the htdocs and zend at the same time then you have to create another virtual host pointing to the htdocs.

Here is some basic about Virtual hosting

http://httpd.apache.org/docs/2.2/vhosts/

Hope this will help..:)

滥情空心 2024-10-24 18:48:30

明白了...在上面链接的快速入门指南中提到的 VirtualHost 定义中,DocumentRoot 和 Directory 被配置为快速启动应用程序,并且如果默认情况下仅在“htdocs”之前提到文档根(不直到应用程序名称/ public),zend 格式的 url 不起作用。

由于我的 htdocs 中有许多 zend 应用程序,因此我必须将 DocumentRoot 和 Directory 的路径设置为“htdocs”本身,因为将来每个应用程序的路径都会有所不同。因此,我在 httpd.conf 文件中添加了以下几行,以使我的应用程序 url 正常工作。现在我可以运行任何 zend 应用程序而无需修改 httpd.conf 文件。

(我还必须告诉客户在他的 httpd.conf 文件中添加这些行以测试应用程序:)

<VirtualHost *:80>
<Directory C:\zend\Apache2\htdocs\>
AllowOverride All
Allow from all
</Directory>
</VirtualHost>

希望它对某人有帮助。

Got it... In the VirtualHost definition mentioned in the quickstart guide in the above link, the DocumentRoot and Directory were configured to the quickstart application, and if the document root was mentioned only till "htdocs" by default (not till application name/public), the zend format url doesn't work.

As i have many zend applications in my htdocs, i had to make the paths of DocumentRoot and Directory till "htdocs" itself, as it will vary in future for each application. So i added the following lines in my httpd.conf file, to make my app url work. Now i can run any zend application without modifying the httpd.conf file.

(and i also had to tell to the client to add these lines in his httpd.conf file for testing the application :)

<VirtualHost *:80>
<Directory C:\zend\Apache2\htdocs\>
AllowOverride All
Allow from all
</Directory>
</VirtualHost>

Hope it helps someone.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文