简体   繁体   English

将Zend部署到子目录

[英]Deploy Zend to a Subdirectory

I just started learning Zend. 我刚刚开始学习Zend。 I managed to get the basic working (using zf create project ) in my local web server. 我设法在本地Web服务器上获得了基本的工作(使用zf create project )。 Let's just say my project is called square 假设我的项目叫Square

The only .htaccess that I have: square/public/.htaccess 我唯一拥有的.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 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>

hosts 主机

127.0.0.1               square

I'm running my application on Linux. 我在Linux上运行我的应用程序。

From what I've gathered, I can open (loaded without any problems) the site using: 从我收集的资料中,我可以使用以下方法打开(加载没有任何问题)该网站:

But I can't open it using: 但是我不能使用以下方式打开它:

I also have other web applications in the same web server. 我在同一台Web服务器上也有其他Web应用程序。 For example, the meh application can be opened using http://192.168.1.10/meh/ but cannot be opened using http://square/meh 例如,可以使用http://192.168.1.10/meh/打开meh应用程序,但不能使用http:// square / meh打开meh应用程序

My question is, how can I load my Zend application without getting problems to other applications in the same server? 我的问题是, 如何在不使同一服务器上的其他应用程序出现问题的情况下加载Zend应用程序? At the moment, I prefer accessing it using my local IP (192.168.1.10). 目前,我更喜欢使用本地IP(192.168.1.10)访问它。 It should be possible to open it from another computer in the same network. 应该可以从同一网络中的另一台计算机打开它。

So, in the end I should be able to load the Zend project using 因此,最后我应该能够使用以下命令加载Zend项目

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

And I can also open my other meh application using http://192.168.1.10/meh 而且我还可以使用http://192.168.1.10/meh打开我的其他meh应用程序

Thanks in advance. 提前致谢。

You can't indeed access your application using 使用你的确不能访问你的应用程序

  • http://square/square/public http:// square / square / public
    • Using the square domain will match your vhost and /square/public will be rewritten to Zend, whom will try to run Square_PublicController::indexAction() 使用square域将匹配您的虚拟主机,并且/square/public将被重写为Zend,Zend将尝试运行Square_PublicController::indexAction()
  • http://192.168.1.10/square/ (got a directory listing) http://192.168.1.10/square/ (获得目录列表)
    • you got a directoy listing (allowed by Options Indexes in <Directory "/home/amree/web"> ) because your .htaccess is located in http://192.168.1.10/square/public 您获得了Directoy列表(由<Directory "/home/amree/web">Options Indexes允许),因为您的.htaccess位于http://192.168.1.10/square/public

You have to make a choice between: 您必须在以下两者之间做出选择:


Or maybe try an Alias in Apache 或者在Apache中尝试使用Alias

Alias /square /square/public

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM