Hi.
I am using WAMP which including the following:
PHP 5...
MySQL 5...
Apache 2...

I want to create IP-Based VirtualHost, therefore I did the following:
1. add "Microsoft Loopback Adapter", and I assign two IP on that.
2. Create two folders named (host1, host2) in my root directory which is www. and for sure inside those two folders I place some php files.
3. and I add the following in my httpd.conf

#********************************* VIRTUAL HOSTING BY IP
Listen 127.0.0.1:8081

Listen 192.168.1.1:8081

Listen 192.168.1.2:8081

NameVirtualHost 192.168.1.1:8081
NameVirtualHost 192.168.1.2:8081

<VirtualHost 192.168.1.1:8081>
	DocumentRoot "C:\wamp\www\host1"
	ServerName host1.com
</VirtualHost>

<VirtualHost 192.168.1.2:8081>
	DocumentRoot "C:\wamp\www\host2"
	ServerName host2.com
</VirtualHost>


#********************************* VIRTUAL HOSTING BY IP

4. and then I added the following in the hosts file

127.0.0.1     localhost
192.168.1.1 host1.com
192.168.1.2 host2.com

5. open the browser and type the following address

I get the following error:

[B]Forbidden[/B]

You don't have permission to access / on this server.

I don't know what to do? anyone please guide me

P.S:
I am working on my own computer, it means I am not in any Network or on the Internet, so I did not use the real computer adapter, because it is unplugged, and therefore I add Microsoft Loopback Adapter

Dani AI

Generated

Quick summary: a 403 usually means Apache is refusing directory access — not DNS. The most common causes here are missing/incorrect <Directory> access rules, Apache version mismatches (2.2 vs 2.4), the loopback IPs not actually bound, or a firewall blocking the port. you already have the right idea with separate IPs; focus next on access rules and whether Apache is really listening on those loopback addresses. is on the right track about allowing access, but the exact directive depends on your Apache version.

Checklist to run now (Windows):

ping host1.com
ipconfig /flushdns
netstat -an | findstr :8081
httpd -v

If ping resolves to the expected loopback IP, DNS is fine. If netstat shows no listener on 192.168.1.x:8081, Apache isn’t bound to that address. Check the Apache error log (via the WAMP tray or the Apache "logs" folder) for lines like "client denied by server configuration" — that confirms a permission/config problem.

If your Apache is 2.4+, add a Directory block for each vhost root so Apache will serve files. Example (adjust the path):

<Directory "C:/wamp/www/your-site-folder">
  Options Indexes FollowSymLinks
  DirectoryIndex index.php index.html
  Require all granted
</Directory>

For older Apache 2.2, use the older authz syntax (as suggested) instead of the 2.4 Require line.

Other quick tips:

  • Temporarily try the raw IP URL () to separate name resolution from vhost logic.
  • Confirm the Microsoft Loopback Adapter actually has the two IPs and is Enabled.
  • Temporarily try listening on 0.0.0.0:8081 or port 80 to rule out firewall/port issues, then revert when done.
  • Restart Apache after any config change.

Follow those steps and post the exact error-log message and the output of netstat/httpd -v if you still get 403 — that will make it easy to pinpoint the remaining issue.

Recommended Answers

All 2 Replies

any idea plz ???

Throw this inside each individual virtual host:

**** Between these lines***

AllowOverride All
Order allow,deny
Allow from all

****^^^*****

Also, if your going to want www.site.com you should alias it or make site.com an alias.

info from config file:
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.