日期:2012-04-04  浏览次数:20408 次

【apache安装】
复制代码 代码如下:

httpd.exe -k install -n "apache2.2.15"
httpd.exe -k start -n "apache2.2.15"

【apache卸载】
复制代码 代码如下:

httpd.exe -k stop -n "apache2.2.15"
httpd.exe -k uninstall -n "apache2.2.15"

【httpd.conf配置关键】
复制代码 代码如下:

ServerRoot "D:/APM/Apache2.2.15"
Listen 80
# 压缩发送给客户端的内容 gzip支持
#LoadModule deflate_module modules/mod_deflate.so
# LoadModule cgi_module modules/mod_cgi.so
# fastcgi
LoadModule fcgid_module modules/mod_fcgid.so
LoadModule rewrite_module modules/mod_rewrite.so
DocumentRoot "D:/APM/Apache2.2.15/htdocs"
# 支持 php 脚本
# fastcgi模式将此行注释
# 直接在虚拟主机中可配置每个站点使用不同版本的php 或者不同的cgi
#Include conf/extra/httpd-php.conf
# Fancy directory listings 华丽的目录清单
Include conf/extra/httpd-autoindex.conf
# Virtual hosts 虚拟主机
#Include conf/extra/httpd-vhosts.conf
# fastcgi模式虚拟主机
Include conf/extra/httpd-vhosts-fcgid.conf
# Various default settings 页脚显示版本信息AccessFileName .htaccess
Include conf/extra/httpd-default.conf

【httpd-php.conf参考】
复制代码 代码如下:

#
# 查找 /APM/php-5.2.12-Win32 替换
#
SetEnv PHPRC "/APM/php-5.2.12-Win32"
SetEnv TMP "/tmp"
# UnsetEnv PERL5LIB
# 加载dll省去在PATH中添加php路径
#LoadFile "/APM/php-5.2.12-Win32/libpq.dll"
LoadFile "/APM/php-5.2.12-Win32/libmysql.dll"
LoadFile "/APM/php-5.2.12-Win32/libmcrypt.dll"
LoadFile "/APM/php-5.2.12-Win32/libmhash.dll"
LoadFile "/APM/php-5.2.12-Win32/libeay32.dll"
LoadFile /APM/php-5.2.12-Win32/ssleay32.dll
#
# PHP-Module setup
#
LoadFile "/APM/php-5.2.12-Win32/php5ts.dll"
LoadModule php5_module "/APM/php-5.2.12-Win32/php5apache2_2.dll"
SetHandler application/x-httpd-php
SetHandler application/x-httpd-php-source
# Load php.ini File Dir
PHPIniDir "/APM/php-5.2.12-Win32"
AddType text/html .php .phps

【httpd-vhosts.conf参考】
复制代码 代码如下:

NameVirtualHost *:80
#文档目录
DocumentRoot "/vhosts/localhost"
#名字 如www.php.net
ServerName localhost
#别名 如php.net
ServerAlias 127.0.0.1
#错误日志文件
ErrorLog "logs/dummy-host.localhost-error_log"
#目录访问规则
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
#目录索引文件
DirectoryIndex index.html index.htm index.php
[html]
【httpd-vhosts-fcgid.conf参考】
[code]
#FcgidInitialEnv PHPRC "/APM/php5210"
#FcgidInitialEnv PATH "/APM/php5210;C:/WINDOWS/system32;C:/WINDOWS;C:/WINDOWS/System32/Wbem;"
#FcgidInitialEnv SystemRoot "C:/Windows"
#FcgidInitialEnv SystemDrive "C:"
#FcgidInitialEnv TEMP "C:/WINDOWS/Temp"
#FcgidInitialEnv TMP "C:/WINDOWS/Temp"
#FcgidInitialEnv windir "C:/WINDOWS"
FcgidIOTimeout 64
FcgidConnectTimeout 16
FcgidMaxRequestsPerProcess 500
NameVirtualHost *:80
DocumentRoot "/vhosts/localhost"
ServerName localhost
ServerAlias 127.0.0.1
ErrorLog "logs/dummy-host.localhost-error_log"
Options Indexes FollowSymLinks ExecCGI
#Options +ExecCGI
AllowOverride All
#AddHandler fcgid-script .php
#FCGIWrapper /APM/php5210/php-cgi.exe .php
#"
AddHandler fcgid-script .php
FcgidWrapper "/APM/php-5.2.13-nts-Win32/php-cgi.exe" .php
#FcgidWrapper "/APM/php-5.3.2-nts-Win3