Reputation: 746
I have installed zend framework 2 in xamp (Windows) & its accessible when i call http://localhost/zf2-tutorial/public/
. I am trying to set virtual host using the below config using httpd-vhosts.conf
<VirtualHost *:80>
ServerName zf2-tutorial.localhost
DocumentRoot "D:/xampp/htdocs/zf2-tutorial/public"
SetEnv APPLICATION_ENV "development"
<Directory D:/xampp/htdocs/zf2-tutorial/public>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
and have configured 127.0.0.1 zf2-tutorial.localhost
in host file. but when i call zf2-tutorial.localhost
in browser, all i get is http://zf2-tutorial.localhost/xampp/
. I also tried adding this in httpd.conf
, still the result is same. Please Help ?
Upvotes: 0
Views: 2201
Reputation: 746
I finally found what was wrong, i never added vhost for local host. Once, i configured the localhost in httpd-vhost.cong like this, it worked perfectly. Thanks for all your help
<VirtualHost *:80>
DocumentRoot "D:\xampp\htdocs"
ServerName localhost
</VirtualHost>
Upvotes: 0
Reputation: 1688
If you configure the virtual host in the file httpd-vhost.com
make sure that the virtual host include file is uncommented in httpd.conf file, i.e. remove the # from the beginning of the line Include conf/extra/httpd-vhosts.conf
Upvotes: 1
Reputation: 2420
I personally dont like the xammp software and rather set up my own apache but there shouldn't be to many differences in setting up a project. I also like having alias's for my project's rather then accessing them trough "localhost" or a "ip". My config usually looks something like this:
<VirtualHost *:80>
ServerName tutorial.local
ServerAlias tutorial.local
DocumentRoot c:/Apache24/htdocs/tutorial/public/
SetEnv APPLICATION_ENV "development"
<Directory c:/Apache24/htdocs/tutorial/public/>
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
After setting up the Virtual Host with the aliases you'll have to open your hosts file within FILESYSTEM:\windows\System32\drivers\etc\
and add a host.
localhost or IP tutorial.local
keep in mind that you'll have to open this file as a administrator and may disable your Antivirus/Spyblocker.
Upvotes: 0