403 Forbidden Error. Hosting a website on my PC with WAMP?

扶醉桌前 提交于 2019-12-11 09:57:44

问题


I'm running Windows 7 Ultimate 64-Bit and have WAMP installed, nothing configured though. I'm using dynamic IP address. I have some web files that i want to host temporarily on my PC so that others can access it.

After turning all the services on and putting the server online, i get "Forbidden You don't have permission to access / on this server" when i type the external IP address of my machine. though it works with "localhost" and "127.0.0.1" rightly points to the www folder. Port 80 is opened and Windows firewall is disabled.

What is the problem? Where does my external IP address points on the server and how can i change it to the desired directory?


回答1:


First, check that the 'Put Online' worked properly, it may not have, if you have manually altered the default state of this section of httpd.conf file.

look at httpd.conf, when it is set ONLINE and it should say :-

For Apache versions 2.2.x

#   onlineoffline tag - don't remove
    Order Allow,Deny
    Allow from all

For Apache versions 2.4.x

#   onlineoffline tag - don't remove
    Require all granted

Change it manually if it does not.

Also if you have setup vhosts check the definition you created for ServerName localhost and make sure that is also set the same.

PS. While quick and easy this does open your whole WAMP Apache server up to access from external address's. It would be better to create a VHOST for your site so you can allow access to that from anywhere but keep the basic WAMP area safe and accessible from only localhost.

When you say you are entering the external IP Address of your machine, if you mean the WAN ip address i.e. the routers external address, most home routers do not allow loop back which would be required to make that work. So try accessing it from your smart phone ( while not connected to your router) or go to a friends and try it from there that will be your only accurate test of whether your config is working.




回答2:


After replacement of

Order Deny,Allow
Deny from all
Allow from 127.0.0.1

with this

AllowOverride None
Allow from all

restart all services and make sure that you have put in online(left click on wamp icon and last option put online).

It's solved my 403 forbidden error.



来源:https://stackoverflow.com/questions/18173351/403-forbidden-error-hosting-a-website-on-my-pc-with-wamp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!