apache 2.2安装

       下载apache2.2 http server,安装next,见到set type,选择custom类型安装,change改变安装路径,next到finsh安装完成,默认80端口,打开浏览器http://localhost,show view "it works !"成功安装。

 

  配置环境变量,在path变量编辑结尾加上E:\PHP\PHP Server\bin;指向bin目录。

  启动服务:httpd -k start[shutdown][rstart]  

  查看活动端口:netstat -anb

 

 

打安装目录,例如:E:\PHP\PHP Server\conf,在conf目录下可修改httpd.conf配置文件,修改端口,文件存放路径。

更改文件存放目录例如:打开httpd.conf配置文件,找到<IfModule dir_module> tag 在后面增加如下:

#配置虚拟目录
<IfModule dir_module>
#默认主页
DirectoryIndex index.html index.htm index.php
#映射网站的别名
Alias /myphp "E:/myphp"
<Directory E:/myphp>
#访问权限配置
Order allow,deny
</Directory>
</IfModule>

并且注释#DocumentRoot "E:/PHP/PHP Server/htdocs"

 

 

 

 

配置虚拟主机

# Virtual hosts
#Include conf/extra/httpd-vhosts.conf

去掉注释,并打httpd-vhosts.conf文件,增加如下:

<VirtualHost 127.0.0.1:80>
DocumentRoot "E:/myphp"
DirectoryIndex index.html index.htm index.php
<Directory />

options FollowSymLinks

Allowoverride None

Order allow,deny
Allow from all
</Directory>
</VirtualHost>   

 增加本地域名映射:

打开目录:C:\Windows\System32\drivers\etc

下的hosts文件,增加

127.0.0.1      www.myphp.com

 

//绑定多个站点,需要添加ServerName区分

 

<VirtualHost *:80>
DocumentRoot "E:/myphp"

ServerName www.myphp.com

DirectoryIndex index.html index.htm index.php

<Directory />

options FollowSymLinks

Allowoverride None

Order allow,deny
Allow from all
</Directory>
</VirtualHost>  

2.

<VirtualHost *:80>
DocumentRoot "E:/myphp2"

ServerName www.myphp2.com

DirectoryIndex index.html index.htm index.php

<Directory />

options FollowSymLinks

Allowoverride None

Order allow,deny
Allow from all
</Directory>
</VirtualHost> 

 

转载于:https://www.cnblogs.com/Donie/p/3874164.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值