[Apache] 2009-06-10 16:57 我来说两句  

在Localhost上开几个虚拟主机,并在Apache上配置

Windows下有一个简单的DNS路由,就是利用 windows\system32\drivers\etc\hosts 这个文件

打开该文件,可以看到有下面的一条记录
127.0.0.1       localhost

这就是为什么我们在浏览器输入localhost的时候,总是会进入本机的原因。

好了,我们现在要继续增加几个虚拟的主机,其IP也全部指向本机。

127.0.0.1       www.host.lan
127.0.0.1       mysql.host.lan
127.0.0.1       jobeet.host.lan

之后,只要在浏览器输入上面的网址的话,都会进入本机。
不过,单单设置了IP指向,还是没用的,还要解释虚拟主机的主机头
所以,我们还需要在Apache的httpd.conf中,加入以下资料:

NameVirtualHost 127.0.0.1:80
 
ServerName www.host.lan
DocumentRoot "C:/WebSite"
DirectoryIndex index.php

其它两个也是类似的设置。之后再输入网址,就能直接到达你的虚拟主机首页了。

 
  • 1. Pupskievua
    2009-06-17 at 07:12

    Hello, All my pictures are 100% genuine and updated.. Sexy Kiev Girl. Kiev girls. I pretty.

  • 2. Derekp
    2009-06-25 at 07:33

    I think i’ve seen this somewhere before…but it’s not bad at all

  • 3. derekpm
    2009-07-12 at 22:58

    Rather interesting. Has few times re-read for this purpose to remember. Thanks for interesting article. Waiting for trackback

3 条留言 | 欢迎您也来跟两句

必填

必填(不对外显示)

:victory: :titter: :think: :surprise: :snooty: :smoke: :smile: :shout: :ruth: :question: :puzzle: :plutus: :noway: :laugh: :insidious: :ill: :hint: :hearten: :happy: :fury: :find: :faint: :embarrass: :congrats: :calculate: :bye: :avarice: :approve: :ablush:

可用的HTML标签如下:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

About
My sun

   人生路上,是非无常,祸福旦夕。放得开胸怀,才能收得下世界。--煮茶村长。

Calendar
09月 2010
« Jul    
 1234
567891011
12131415161718
19202122232425
2627282930