Home > Backend Development > PHP Tutorial > Why Am I Getting a 403 Forbidden Error When Accessing My WAMP Server on My Local Network?

Why Am I Getting a 403 Forbidden Error When Accessing My WAMP Server on My Local Network?

DDD
Release: 2024-10-30 11:42:27
Original
369 people have browsed it

 Why Am I Getting a 403 Forbidden Error When Accessing My WAMP Server on My Local Network?

WAMP Cannot Access on Local Network 403 Forbidden

Access issues to WAMP servers on a local network can be frustrating, especially when using the server's IP address instead of localhost. Follow this comprehensive guide to resolve the 403 Forbidden error when attempting to access your WAMP server from another computer.

For WAMPServer Versions <= 2.5:

By default, WAMPServer restricts access to the server from the local machine only. To enable access from other devices on the network, modify the httpd.conf file located in your WAMPServer installation directory.

  1. Find the following section in the httpd.conf file:
#   onlineoffline tag - don't remove
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
Allow from ::1
Allow from localhost
Copy after login
  1. Replace the above section with the following:
#   onlineoffline tag - don't remove
Require local
Require ip 192.168.0
Copy after login

The Require local statement allows access from local IP addresses, including 127.0.0.1 and localhost. The Require ip 192.168.0 statement allows access from any IP address within the 192.168.0 network. Adjust the IP address range as needed for your network configuration.

  1. Restart Apache after saving the changes.

For WAMPServer 3 and Above:

With WAMPServer version 3 and above, a different approach is required.

  1. Open the httpd-vhosts.conf file located in the WAMPServer installation directory.
  2. Find the Virtual Host definition for localhost:
<VirtualHost *:80>
    ServerName localhost
    DocumentRoot D:/wamp/www
    <Directory  "D:/wamp/www/">
        Options +Indexes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local
    </Directory>
</VirtualHost><ol start="3"><li>Replace the Require local line with Require all granted:</li></ol>
<pre class="brush:php;toolbar:false"><VirtualHost *:80>
    ServerName localhost
    DocumentRoot D:/wamp/www
    <Directory  "D:/wamp/www/">
        Options +Indexes +FollowSymLinks +MultiViews
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>
Copy after login
  1. If necessary, modify a Virtual Host definition for your project website in the same manner.
  2. Restart Apache after saving the changes.

Additional Troubleshooting Tips:

  • Ensure that port forwarding is configured correctly on your router and Windows Firewall is allowing connections to your WAMP server.
  • If you are using a security software, whitelist the WAMPServer process or manually open the necessary ports.
  • Verify that your computer network settings are configured correctly and that both computers are connected to the same network.

The above is the detailed content of Why Am I Getting a 403 Forbidden Error When Accessing My WAMP Server on My Local Network?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template