非集成php 多站点多端口配置

来源:互联网 发布:js json对象取值 编辑:程序博客网 时间:2024/06/03 18:35

第一步:打开Apache :httpd.conf文件
Include conf/extra/httpd-vhosts.conf 把这行的#去除,去除#说明开始载入扩展 (extra是扩展文件夹)

#Listen12.34.56.78:80
Listen 80
Listen
8081
Listen
8082
Listen
8083
#增加监听端口

第二步:配置conf/extra/httpd-vhosts.conf

    ServerAdmin webmaster@dummy-host.localhost
    DocumentRoot "D:/www/basic/web"
    ServerName
localhost   
    ServerAlias
localhost       
    ErrorLog "logs/dummy-host.localhost-error.log"
    CustomLog "logs/dummy-host.localhost-access.log" common



例子内容详解:

ServerAdmin webmaster...(apache邮件地址,管理员地址,如果不要这行就默认找到apache在系统中默认的邮件地址,可删除

最简单组合,地址+服务名就可以了

 

DocumentRoot "C:/www/a_com"  (当前虚拟主机指向的文件夹

ServerName 127.0.0.2 访问地址:127.0.0.2

 

ServerAlials ..(多个域名可以指向一个站点,多个站点也可以指向一个域名,如果有多个域名的可以在这里写上,可删除

ErrorLog...(错误日志,可删除

CustomLog..(访问日志,可删除

...


要是访问80端口304  需要注释文件开始的80端口配置:

#
   ServerAdminwebmaster@dummy-host.example.com
  DocumentRoot "c:/Apache24/docs/dummy-host.example.com"
   ServerNamedummy-host.example.com
   ServerAliaswww.dummy-host.example.com
   ErrorLog"logs/dummy-host.example.com-error.log"
   CustomLog"logs/dummy-host.example.com-access.log" common
#

#
   ServerAdminwebmaster@dummy-host2.example.com
  DocumentRoot "c:/Apache24/docs/dummy-host2.example.com"
   ServerNamedummy-host2.example.com
   ErrorLog"logs/dummy-host2.example.com-error.log"
   CustomLog"logs/dummy-host2.example.com-access.log" common
#


    ServerAdminwebmaster@dummy-host2.example.com
    DocumentRoot"D:/www"
    ServerNamedummy-host.x
    ServerAliaswww.dummy-host.x
    ErrorLog"logs/dummy-host.x-error.log"
    CustomLog"logs/dummy-host.x-access.log" common

配置好就可以用127.0.0.1:9082访问站点了



原创粉丝点击