简体   繁体   English

Wamp的虚拟主机配置

[英]Virtual Host configuration for Wamp

I am writing one web application using php, But I don't know how to access my website directly from localhost. 我正在使用php编写一个Web应用程序,但是我不知道如何直接从本地主机访问我的网站。

I have configured VirtualHost in apache but still not working, 我已经在Apache中配置了VirtualHost,但仍然无法正常工作,

<VirtualHost *:80>
    DocumentRoot "C:/wamp/www/top10"
    ServerName top10.com

    <Directory "C:/wamp/www/top10" >
        allow from all
        order allow,deny
        AllowOverride all
    </Directory>
    DirectoryIndex index.html index.php
</VirtualHost>

I have also add the same ServerName entry in hosts file 我还在主机文件中添加了相同的ServerName条目

When I try to access I am getting following error 当我尝试访问时出现以下错误

Not Found

The requested URL / was not found on this server.

Apache/2.4.9 (Win32) PHP/5.5.12 Server at top10.com Port 80

I want to access my website as http://top10.com instead of http://localhost/top10 . 我想以http://top10.com而不是http:// localhost / top10访问我的网站。

Could you please help me for this 你能帮我吗

Open hosts file ( AS Administrator ) in C:/Windows/System32/drivers/etc/ and add the following line ( Don't delete anything ) 在C:/ Windows / System32 / drivers / etc /中打开主机文件(AS管理员),然后添加以下行(不要删除任何内容)

127.0.0.1 myWebsite.local 127.0.0.1 myWebsite.local

change myWebsite.local as per your name requirements 根据您的姓名要求更改myWebsite.local

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM