apache多域名多端口

apache多端口映射

 

我使用一个apache服务器。在我的apache根目录下有这么几个网站,如Test、Child这两个文件夹,也就是两个网站。我想这 样,当我访问http://localhost的时候就访问Test,当我访问http://localhost:8080的时候就访问Child。

我们需要配置apache。讲apache文件夹下的conf中的httpd.conf打开,搜索Include conf/extra/httpd-vhosts.conf,将前面的注释去掉。再打开conf/extra/httpd-vhosts.conf文件, 清除里面的内容,这样写道:

 

NameVirtualHost *:8080
<VirtualHost *:8080>
ServerName localhost
ServerAlias localhosts
DocumentRoot D:/development/www/Child
</VirtualHost>
NameVirtualHost *:80
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot D:/development/www/Test
</VirtualHost>

 

 

重启apache服务器就ok了。

 

 

Listen 8088
Listen 8887
Listen 8888

 

NameVirtualHost 183.1.1.8:8088
NameVirtualHost 183.1.1.8:8887
NameVirtualHost 183.1.1.8:8888

<VirtualHost 183.1.1.8:8088>
   DocumentRoot "/Data/webdata/crm"
   <Directory "/Data/webdata/crm">
      AllowOverride all
      Order deny,allow
      allow from all
   </Directory>
   ServerName 183.1.1.8
</VirtualHost>

<VirtualHost 183.1.1.8:8887>
   DocumentRoot "/Data/webdata/c"
   <Directory "/Data/webdata/c">
      AllowOverride all
      Order deny,allow
      allow from all
   </Directory>
   <FilesMatch "^\.ini">
    Order allow,deny
    Deny from all
    Satisfy All
   </FilesMatch>
   ServerName 183.1.1.8
</VirtualHost>

<VirtualHost 183.1.1.8:8888>
   DocumentRoot "/Data/webdata/s"
   <Directory "/Data/webdata/s">
      AllowOverride all
      Order deny,allow
      allow from all
   </Directory>  
   ServerName 183.1.1.8
</VirtualHost>

posted @ 2013-04-06 01:52  hanks  阅读(832)  评论(0)    收藏  举报