I am working through this tutorial- https://docs.zendframework.com/tutorials/getting-started/skeleton-application/
In trying to get it setup on an Apache local server I have used this code-
<VirtualHost *:80>
ServerName zf-tutorial.localhost
DocumentRoot /var/www/html/skeleton-application/public
SetEnv APPLICATION_ENV "development"
<Directory /var/www/html/skeleton-application/public>
DirectoryIndex index.php
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
When I try and go to http://zf-tutorial.localhost I see a directory listing that looks like this-
This url- http://zf-tutorial.localhost/skeleton-application/public/ actually displays the correct index.php file.
How do I get http://zf-tutorial.localhost to display the index.php file?
2
Answers
Try to remove Apache’s default virtual host:
and reload the web server for the changes to take effect.
I like to have everything sorted and connected well. I care about directory names to match configuration files and names so I will leave you here how I would do that.
/var/www/zf-tutorial.localhost
cd /etc/apache2/sites-available
sudo cp 000-default.conf zf-tutorial.localhost.conf
ServerName
tozf-tutorial.localhost
DocumentRoot
to/var/www/zf-tutorial.localhost/public
SetEnv APPLICATION_ENV "development"
${APACHE_LOG_DIR}/zf-tutorial.localhost.access.log
and${APACHE_LOG_DIR}/zf-tutorial.localhost.error.log
sudo a2ensite zf-tutorial.localhost.conf
sudo service apache2 reload
Here you should be ready to go. With this, you don’t need that separate VirtualHost rule up there since you set it now in separated configuration file.