Issue
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?
Solution
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.
- Install your aplication in
/var/www/zf-tutorial.localhost
cd /etc/apache2/sites-available
sudo cp 000-default.conf zf-tutorial.localhost.conf
- Open that file and change
ServerName
tozf-tutorial.localhost
- Change
DocumentRoot
to/var/www/zf-tutorial.localhost/public
- You can add additional parameters/settings like
SetEnv APPLICATION_ENV "development"
- You can change access log and error log for easier debugging and troubleshooting. For me it would be
${APACHE_LOG_DIR}/zf-tutorial.localhost.access.log
and${APACHE_LOG_DIR}/zf-tutorial.localhost.error.log
- Save and close
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.
Answered By - Tpojka Answer Checked By - Marie Seifert (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.