apache 2.2安装

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

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

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

  查看活动端口:netstat -anb

打安装目录,例如:E:PHPPHP Serverconf,在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:WindowsSystem32driversetc

下的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