Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have several ZF projects running or closed, however, and until today, I always work directly on the remote server.

I would like to switch to a local environment while developing, so I was wondering if anyone would be kind enough to share with me, some virtual host configurations that we should apply on this cases?

The point will be to have:
www/myproject1 folder pointing to: http://myproject1/
www/myproject2 folder pointing to: http://myproject2/
www/myproject3 folder pointing to: http://myproject3/

Any help please?

ps- I see a lot of examples, but when I add Zend to the query, I seem to have troubles.

Thanks a lot,
MEM

share|improve this question

1 Answer 1

up vote 2 down vote accepted

I have done the following on my ubuntu:

  1. Install the zend-framework package with aptitude
  2. Add the path to the zend framework in the include path variable of /etc/php5/apache2/php.ini
  3. set-up 3 projects myproject1, myproject2 and myproject3 inside /var/www using zf create project
  4. In /etc/apache/sites-available, I have added 3 files (myproject1, myproject2 and myproject3) containing the following:
<VirtualHost *:80>
  ServerName myproject1.example.com
  DocumentRoot /var/www/myproject1/public

  SetEnv APPLICATION_ENV "production"

  <Directory /var/www/myproject1/public>
    DirectoryIndex index.php
    AllowOverride All
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>
  1. Activate them using a2ensite myproject1, add the rewrite module with a2enmod rewrite and restart apache.

  2. And finally, I have added the 3 following lines in my /etc/hosts:

127.0.0.1 myproject1.example.com
127.0.0.1 myproject2.example.com
127.0.0.1 myproject3.example.com

And now, I can reach my projects using the URLs http://myproject1.example.com/

If that still does not work for you, would you like please to edit your question with the error messages you get in /var/log/apache2/error.log?

share|improve this answer
    
@uloBasEl: That's an outstanding way of working. :) I cannot try at the moment but that's exactly what I wish and dream about. If I add to all that the git and xdebug I will save it as my holy grail stuff, however, I'm far from learning those two last points. uloBasEl, you rock. Thanks. Cheers! –  MEM Dec 5 '10 at 4:39
    
Great Ans Indeed ... –  chhameed Mar 11 '13 at 12:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.