本帖最后由 Noyskk 于 2011-7-11 21:49 编辑
看到白丁版的教程只针对IIS,干脆写个KPAM(即Kangle+PHP+Apache+MySQL)的教程。
首先介绍下Kangle,这是一款基于Windows的Web Server软件,采用WEB界面方式管理。性能很牛B。。
Now,进入正题。
系统约定:
Apache软件安装位置:
X:\Server Soft\apache
Mysql安装位置:
X:\Server Soft\mysql
PHP安装位置:
X:\Server Soft\PHP
Kangle安装位置:
X:\Server Soft\kangle
网页放置位置:
X:\www
X是本帖中的变量,请根据实际情况修改。
Step1:
在http://ndhnx.tk/downloads/Mini-MySQL-5.1.60.7z下载MySQL 5.1.60精简版(1.8MB)
在http://mirror.bjtu.edu.cn/apache//httpd/binaries/win32/httpd-2.2.19-win32-x86-openssl-0.9.8r.msi下载Apache 2.2.19
在http://windows.php.net/downloads/releases/php-5.2.17-Win32-VC6-x86.zip下载PHP 5.2.17
在http://www.kanglesoft.com/download/2.2/kangle-2.2.8.msi下载Kangle Web Server 2.2
在http://labs.renren.com/apache-mirror//httpd/binaries/win32/mod_fcgid-2.3.6-win32-x86.zip下载Apache Mod_FastCGI 2.36 Win32
Step2:
安装Apache,一路Next即可。安装后修改httpd.conf
找到
段,改为再找到
- DocumentRoot "X:/Server Soft/apache/htdocs"
- #
- # Each directory to which Apache has access can be configured with respect
- # to which services and features are allowed and/or disabled in that
- # directory (and its subdirectories).
- #
- # First, we configure the "default" to be a very restrictive set of
- # features.
- #
- <Directory />
- Options FollowSymLinks
- AllowOverride None
- Order deny,allow
- Deny from all
- </Directory>
- #
- # Note that from this point forward you must specifically allow
- # particular features to be enabled - so if something's not working as
- # you might expect, make sure that you have specifically enabled it
- # below.
- #
- #
- # This should be changed to whatever you set DocumentRoot to.
- #
- <Directory "X:/Server Soft/apache/htdocs">
复制代码
和
- <IfModule dir_module>
- DirectoryIndex index.html index.htm
- </IfModule>
复制代码
改为
- DocumentRoot "X:/www"
- #
- # Each directory to which Apache has access can be configured with respect
- # to which services and features are allowed and/or disabled in that
- # directory (and its subdirectories).
- #
- # First, we configure the "default" to be a very restrictive set of
- # features.
- #
- <Directory />
- Options FollowSymLinks
- AllowOverride None
- Order deny,allow
- allow from all
- </Directory>
- #
- # Note that from this point forward you must specifically allow
- # particular features to be enabled - so if something's not working as
- # you might expect, make sure that you have specifically enabled it
- # below.
- #
- #
- # This should be changed to whatever you set DocumentRoot to.
- #
- <Directory "X:/www">
复制代码 和
- <IfModule dir_module>
- DirectoryIndex index.php index.html index.htm
- </IfModule>
复制代码
然后重启Apache。
Step3:
把下载回来的Apache Mod_FastCGI 2.36 Win32解压到X:\Server Soft\apachemod
把X:\Server Soft\apachemod下的2个文件夹copy到X:\Server Soft\apache\modules下,然后在httpd.conf的末尾添加如下代码
- LoadModule fastcgi_module modules/mod_fcgid.so
- ScriptAlias /fcgi-php5/ "X:/Server Soft/php/"
- FastCgiServer "X:/Server Soft/php/php-cgi.exe" -processes 3
- # 说明:此处的 -processes 3 表示启动三个 php-cgi.exe 进程,
- # 关于 FastCgiServer 的详细参数请参考 FastCGI 文档。
- AddType application/x-httpd-fastphp5 .php
- Action application/x-httpd-fastphp5 "X:/Server Soft/php/php-cgi.exe"
复制代码 重启Apache
Step4:
把php目录下的php.ini-dist改名为php.ini(用recommended也可以),然后修改以下数据
- extension_dir = "."
- fastcgi.impersonate = 1
- cgi.fix_pathinfo=1
- cgi.force_redirect = 1
- ;extension=php_mbstring.dll
- ;extension=php_mcrypt.dll
- ;extension=php_dba.dll
- ;extension=php_dbase.dll
- ;extension=php_gd2.dll
- ;extension=php_mysql.dll
- ;extension=php_mysqli.dll
- short_open_tag = Off
复制代码 改为
- extension_dir = "X:\Server Soft\php\ext"
- fastcgi.impersonate = 1
- cgi.fix_pathinfo=1
- cgi.force_redirect = 0
- extension=php_mbstring.dll
- extension=php_mcrypt.dll
- extension=php_dba.dll
- extension=php_dbase.dll
- extension=php_gd2.dll
- extension=php_mysql.dll
- extension=php_mysqli.dll
- short_open_tag = On
复制代码
然后写个phpinfo.php,内容如下:
保存。拷贝到X:\www 目录下,然后在浏览器中打开http://localhost:8080/phpinfo.php,测试是否正常。
Step5:解压Mini-MySQL-5.1.60.7z,运行X:\Server Soft\mysql目录的menu.bat文件,选第1选项运行后,再选第三选项设置密码,然后把bin文件夹里的dll文件拷贝到X:\Server Soft\php
然后安装kangle,安装后在浏览器输入http://127.0.0.1:3311 进入kangle web管理界面,然后点“ 扩展-->单节点服务器 ”
名字:服务器名字,由你任意设置。服务器类型:有http、fastcgi、ajp三种。选择http协议。 主机地址、端口:127.0.0.1、8080。 生存时间:kangle采用连接池技术,节约系统资源开销,提高性能。设为“ 0 ” ,不启用该项设置,任务完成连接立即断开。
进入管理界面中的“请求控制”
默认目标选择 “服务器” ,然后点击 “ 更改默认目标 ”,选择刚才设置的服务器。
OK~搞定 |