OK, I have my wamp installed and simply can't setup my virtual hosts properly.
Here's what I have:
Wamp install dir: F:\wamp
Projects dir: F:\www
# F:\wamp\bin\apache\apache2.4.2\conf\extra\httpd-vhosts.conf
<Directory "F:\www">
AllowOverride AuthConfig FileInfo Indexes Limit Options
Order Deny,Allow
AllowOverride All
Allow from all
</Directory>
NameVirtualHost 127.0.0.1
<VirtualHost 127.0.0.1>
ServerName localhost
DocumentRoot "F:\wamp\www"
</VirtualHost>
# Yes, it's a symfony2 project
<VirtualHost 127.0.0.1>
DocumentRoot "F:\www\my_project\web"
DirectoryIndex app_dev.php
ServerName my_project
</VirtualHost>
hosts
file from windows is configured and has the necessary: 127.0.0.1 project_name
line included.
Apache httpd.conf
:
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
Now the browser tells me this, when accessing URL: my_project/
Forbidden
You don't have permission to access / on this server.
Could somebody give me a clue on what's going on here?
Try this as your conf/extra/httpd-vhosts.conf
Now you need to add the site name(s) to your hosts file like this.
EDIT:
For your browser to find your site domain names you must tell windows that the domain name you are using for testing exists and which ip address it lives on. You do this by adding your testing domain names to a file called
hosts
. This is read when windows loaded its networking component and cached by a service calledDNS Client
To add new local domain names you must edit the windows hosts file
And add one line for each of your virtual hosts like this
Once this is saved, launch a command prompt using
Run as Administrator
(right click + shift over the Windows command processor icon to show a menu containing theRun as Administrator
menu line) and issue these 2 commands to restart the 'DNS Client' service so it picks up your changes. Alternatively just reboot.when that completes
PS. The double quotes are required as there is a space in the service name!
HOW TO EDIT THE HOSTS FILE
The hosts file is protected by windows, in order to save it you must have Administrator privilages. On Vista/W7/W8 you may think you are an Administrator BUT YOU ARE NOT.
To successfully save the hosts file do this to launch your editor with Admin Privilages.
Locate your editors icon on the desktop or from the Start menus ( notepad will do if you have nothing else ) right click + shift over your chosen editor icon - will show a menu. select "Run As Administrator" from the menu.
Using
file -> open
Navigate your editor to thec:\windows\system32\drivers\etc\hosts
file.When you have made changes you will now be allowed to save them.