开发者

How to access my zend project in browser?

开发者 https://www.devze.com 2023-03-02 01:57 出处:网络
I created a project student in /var/www/But I am unable to access it using virtual hots. zf.sh create prohect student

I created a project student in /var/www/ But I am unable to access it using virtual hots.

zf.sh create prohect student

I created a file student in /etc/apache2/sites-available like this:

<VirtualHost *:80>
        ServerName student.dev
        ServerAlias student.dev
        DocumentRoot /var/www/student/public/
</VirtualHost>

Then I run this in terminal:

sudo a2ensite student

I have following line in /etc/hosts

127.0.0.1    student.dev

After I restarted the apache server:

sudo /etc/init.d/apache2 restart

But when I access http://student.dev/ in browser it gives me following error:

The server encountered an internal error or misconfiguration and was unable to complete your request.

But w开发者_Python百科hen I access http://localhost/student/public/index.php directly then it shows me Welcome successfully like this

Welcome to the Zend Framework!
This is your project's main page

Edit:

.htaccess file in public folder

SetEnv APPLICATION_ENV development

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


You're missing the <Directory> configuration in your vhost config.

Your config has to look like that:

<VirtualHost *:80>
    ServerName student.dev
    DocumentRoot /var/www/student/public/
    <Directory /var/www/student/public/>
        AllowOverride All
    </Directory>
</VirtualHost>

The AllowOverride setting tells apache that .htaccess files in your public directory may override the general settings.

0

精彩评论

暂无评论...
验证码 换一张
取 消