1

I am trying to implement virtual host in my system.

I have used the below code for that.

NameVirtualHost *:80
<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot "/Users/shanker/Documents/content_booking/"  
    ServerName content.boking
    Alias /booking "/Users/shanker/Documents/content_booking/public/"
</VirtualHost>

also i have updated the hosts file as

127.0.0.1 content.booking

But I am getting the following errors:

---------------------------------------------------------
Access forbidden!

You don't have permission to access the requested directory. There is either no index document or the directory is read-protected.

If you think this is a server error, please contact the webmaster.
Error 403
---------------------------------------------------------

Can anybody please fix this issue.

Marc B
  • 356,200
  • 43
  • 426
  • 500
user1306297
  • 21
  • 1
  • 2

4 Answers4

2

First check your httpd.conf file in Apache and make sure Virtual hosts is on. (remove the '#' to turn on/uncomment).

 #Virtual hosts
 Include conf/extra/httpd-vhosts.conf

next update your vhosts-file with some Directory options.

<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "/Users/shanker/Documents/content_booking/"  
ServerName content.boking
<Directory "C:/Users/shanker/Documents/content_booking/">
  Options Indexes FollowSymLinks ExecCGI
  AllowOverride All
  Order allow,deny
  Allow from all
</Directory>
Alias /booking "/Users/shanker/Documents/content_booking/public/"

Hope this helps.

mata
  • 67,110
  • 10
  • 163
  • 162
Shadoath
  • 21
  • 3
1

Your ServerName is with one "o", and your hosts file entry is with "oo" (two).

Does it work once you fix that typo?

Camden S.
  • 2,185
  • 1
  • 22
  • 27
1

If you do not include an index.[html|htm|php] in a directory, the default action may be to list all the files in that directory or more commonly for security, to throw this error.

http://127.0.0.1/ causes Apache to look for index.[html|htm|php] files and if there isn't one there and your security doesn't allow listing the directory (which it shouldn't), this is the error.

Create an index.html file in the proper directory and see if that helps.

CLo
  • 3,650
  • 3
  • 26
  • 44
0

OS X's permissions, etc. are set up (out of box) to serve web documents from /Users/shanker/Sites so, if it's a permissions related issue, you might just try moving your code there to the /Users/shanker/Sites/content_booking/ directory and updating the DocumentRoot directive to side-step any permissions issues.

Camden S.
  • 2,185
  • 1
  • 22
  • 27