Apache HTTP Server Version 2.2 中文在线文档:
http://lamp.linux.gov.cn/Apache/ApacheMenu/index.html
* 修改webapps的路径则需修改变量DocumentRoot,以及Directory,例如:
DocumentRoot "D:\DEV_ENV\DiscuzExp\wwwroot"
<Directory "D:\DEV_ENV\DiscuzExp\wwwroot">
Options Indexes FollowSymLinks
Order allow,deny
Allow from all
</Directory>
* 如果要让apache2 支持php5,则修改htppd.conf
# For PHP 5 do something like this:
LoadModule php5_module "c:/php/php5apache2.dll"
AddType application/x-httpd-php .php
# configure the path to php.ini
PHPIniDir "C:/php"
* 将Apache注册为windows服务 以及 卸载服务的方法如下:
@ECHO OFF
ECHO 正在启动 Apache web服务,请稍候...
"D:\DEV_ENV\Apache\Apache2.2\bin\httpd.exe" -k install -n apache2.2
net start apache2.2
卸载服务:
@ECHO OFF
ECHO 正在停止 Apache web服务,请稍候...
net stop apache2.2
"D:\DEV_ENV\Apache\Apache2.2\bin\httpd.exe" -k uninstall -n apache2.2
Apache 下基于名字的虚拟主机设置,步骤:
1. 设置Directory
2. 设置NameVirtualHost
3. 设置VirtualHost
<Directory "D:/DEV_ENV/Apache/website-wp">
Options FollowSymLinks Indexes
Allow from all
Order allow,deny
AllowOverride None
</Directory>
<Directory "D:/DEV_ENV/Apache/website-yatu">
Options FollowSymLinks Indexes
Allow from all
Order allow,deny
AllowOverride None
</Directory>
NameVirtualHost 192.168.1.120
<VirtualHost 192.168.1.120>
DocumentRoot "D:/DEV_ENV/Apache/website-wp"
ServerName wp.com
DirectoryIndex index.php index.html
</VirtualHost>
<VirtualHost 192.168.1.120>
DocumentRoot "D:/DEV_ENV/Apache/website-yatu"
ServerName yatu.com
DirectoryIndex index.php index.html
</VirtualHost>
Apache 下基于IP的虚拟主机设置
1:单个IP对应单个域名
例如:www.phpunion.com对应192.168.1.1
www.feelone.net对应192.168.1.2
在httpd.conf中加入如下指令
<VirtualHost 192.168.1.1> #对应玉米所指向的IP
DocumentRoot "c:/web/php" #www.phpunion.com要指向的目录,注意一定要有""
ServerName www.phpunion.com #所要绑的玉米
</VirtualHost>
<VirtualHost 192.168.1.2> #对应玉米所指向的IP
DocumentRoot "c:/web/feel" #www.feelone.net要指向的目录,注意一定要有""
ServerName www.feelone.net #所要绑的玉米
</VirtualHost>
~~~~~~~~~~~~~~~