设置虚拟主机后,Wamp 2.5本地主机无法工作,我收到403禁止错误 [英] Wamp 2.5 local host doesn't work after I have setup virtual hosts I get 403 forbidden error

查看:67
本文介绍了设置虚拟主机后,Wamp 2.5本地主机无法工作,我收到403禁止错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我键入localhost时,我现在已经设置了虚拟主机,它不起作用.我想现在我必须为其自身的本地主机创建一个虚拟主机,并且它可以工作,但是现在当我键入外部ip时,它不起作用它说禁止403,所以我该如何解决这个问题,我必须为我的外部IP创建一个虚拟主机,并且对所有人或仅对我的计算机都有效,例如,如果我给一个朋友并且他输入我的外部IP会起作用吗?

I have setup virtual hosts now when I type localhost it does not work I figured that now I'll have to make a virtual host for local host it self and it worked but now when I type my external ip it does not work it says 403 forbidden so how do i fix this do I have to make a virtual host for my external ip and will it work for everyone or just my computer for example if I give to a friend and he typed my external ip will it work?

推荐答案

创建虚拟主机时,Apache会忽略httpd.conf中定义的主机,即localhost.因此,您还必须为本地主机创建一个虚拟主机.

When you create Virtual Hosts, Apache ignored the host defined in httpd.conf i.e. localhost. So you have to create a vhost for localhost as well.

为了安全起见,它应该是定义的第一个虚拟主机,就像有人只是尝试您的IP地址一样,Apache将默认使用第一个虚拟主机,并且将使用仅本地访问进行定义,并且他们将获得一个错误,提示您不允许进入.

For security it should be the first vhost defined, as if someone just tries your ip address, Apache will default to the first vhost and that will be defined with only local access and they will get an error saying you are not allowed in.

根据您的其他问题,仅当用户实际输入有效的xxx.tk域名时,才应允许访问您的.tk域,如果用户仅使用wan ip地址,则不允许访问.

As per your other question, you should only be allowing access to your .tk domains if the user actually enters a valid xxx.tk domain name and disallow access if they just use your wan ip address.

# Should be the first VHOST definition so that it is the default virtual host
# Also access rights should remain restricted to the local PC and the local network
# So that any random ip address attack will recieve an error code and not gain access
<VirtualHost *:80>
    ServerAdmin webmaster@homemail.net
    DocumentRoot "c:/wamp/www"
    ServerName localhost
    ServerAlias localhost
    <Directory  "c:/wamp/www">
        AllowOverride All
        <IfDefine APACHE24>
            Require local
        </IfDefine>
        <IfDefine !APACHE24>
            Order Deny,Allow
            Deny from all
            Allow from 127.0.0.0 localhost ::1 
        </IfDefine>
    </Directory>
</VirtualHost>

这篇关于设置虚拟主机后,Wamp 2.5本地主机无法工作,我收到403禁止错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆