将Zend部署到子目录

问题描述 投票:0回答:1

我刚刚开始学习Zend。 我设法在本地Web服务器上获得了基本的工作(使用zf create project )。 假设我的项目叫Square

我唯一拥有的.htaccess: square / public / .htaccess

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]

httpd.conf

DocumentRoot "/home/amree/web"

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

<Directory "/home/amree/web">
    Options Indexes FollowSymLinks
    AllowOverride all
    Order allow,deny
    Allow from all
</Directory>

NameVirtualHost square
<VirtualHost square>
    DocumentRoot "/home/amree/web/square/public"
    ServerName square
</VirtualHost>

主机

127.0.0.1               square

我在Linux上运行我的应用程序。

从我收集的资料中,我可以使用以下方法打开(加载没有任何问题)该网站:

但是我不能使用以下方式打开它:

我在同一台Web服务器上也有其他Web应用程序。 例如,可以使用http://192.168.1.10/meh/打开meh应用程序,但不能使用http:// square / meh打开meh应用程序

我的问题是, 如何在不使同一服务器上的其他应用程序出现问题的情况下加载Zend应用程序? 目前,我更喜欢使用本地IP(192.168.1.10)访问它。 应该可以从同一网络中的另一台计算机打开它。

因此,最后我应该能够使用以下命令加载Zend项目

  1. http://192.168.1.10/square
  2. http://192.168.1.10/square/public
  3. http://192.168.1.10/square/public/default/index/index

而且我还可以使用http://192.168.1.10/meh打开我的其他meh应用程序

提前致谢。

apache zend-framework
1个回答
1
投票

使用你的确不能访问你的应用程序

  • http:// square / square / public
    • 使用square域将匹配您的虚拟主机,并且/square/public将被重写为Zend,Zend将尝试运行Square_PublicController::indexAction()
  • http://192.168.1.10/square/ (获得目录列表)
    • 您获得了Directoy列表(由<Directory "/home/amree/web">Options Indexes允许),因为您的.htaccess位于http://192.168.1.10/square/public

您必须在以下两者之间做出选择:


或者在Apache中尝试使用Alias

Alias /square /square/public
© www.soinside.com 2019 - 2024. All rights reserved.