zf2 setup on ubuntu 13.10 with Apache virtual host

apache, php, ubuntu, virtualhost, zend-framework2

Solution

Thanks all,

I have found the problem.

In apache 2.4.6 and ubuntu 13.10 we need to update apache2.conf change in

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

with

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

and create your virtual host file something like this,

<VirtualHost zfapp.com:80>
    ServerName zfapp.com

    DocumentRoot /var/www/zfapp/index

    <Directory /var/www/zfapp/index>
                Options Indexes FollowSymLinks
                AllowOverride All
                Require all granted
        </Directory>

    ErrorLog /var/log/apache2/error.log
    CustomLog /var/log/apache2/access.log combined
</VirtualHost>

I have found solution from: https://askubuntu.com/questions/423514/how-to-enable-mod-rewrite-for-virtual-host

by the way, thanks @Bilal , @jmleroux

Problem

I am configuring Zend application (ZF2) in ubuntu 13.10. Following the steps below : - Place code in `/var/www/` with name `zfapp` Virtual host config : ``` <VirtualHost *:80> ServerName zfapp.com DocumentRoot /var/www/zfapp/ <Directory /> Options FollowSymLinks AllowOverride All </Directory> ErrorLog /var/log/apache2/error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog /var/log/apache2/access.log combined </VirtualHost> ``` Creating virtual host for it in `/etc/hosts` 127.0.0.1 zfapp.com Add file in `/etc/apache2/sites-available/zfapp.cof` `sudo a2enmod rewrite` `sudo a2ensite zfapp.conf` `sudo service apache2 restart` However when I browse to the site (`zfapp.com/api/user/auth`); It gives following error: Not Found The requested Url `/api/user/auth` was not found on this server I have a javascript MVC project in which i am using PHP as server side language. Here is the project directory structure: ProjectDir javascriptMVC folder-> models/controllers jsfiles api folder -> Zend project I have made a symbolic link api which points to `api/public` inside javascriptMVC directory, which i use in AJAX calls to PHP server. like `/api/user/auth`. The same structure works on old Ubuntu machine. I think it has something to do with Apache configuration; or perhaps I have to set any Alias?

Original source