Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[其他] Kangle+Apache+PHP+MySQL配置教学(XP、2003、win7、vista 32位)

[复制链接]
Noyskk 发表于 2011-7-10 18:35:25 | 显示全部楼层 |阅读模式
本帖最后由 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
找到
  1. Listen 80
复制代码
段,改为
  1. Listen 8080
复制代码
再找到

  1. DocumentRoot "X:/Server Soft/apache/htdocs"

  2. #
  3. # Each directory to which Apache has access can be configured with respect
  4. # to which services and features are allowed and/or disabled in that
  5. # directory (and its subdirectories).
  6. #
  7. # First, we configure the "default" to be a very restrictive set of
  8. # features.  
  9. #
  10. <Directory />
  11.     Options FollowSymLinks
  12.     AllowOverride None
  13.     Order deny,allow
  14.     Deny from all
  15. </Directory>

  16. #
  17. # Note that from this point forward you must specifically allow
  18. # particular features to be enabled - so if something's not working as
  19. # you might expect, make sure that you have specifically enabled it
  20. # below.
  21. #

  22. #
  23. # This should be changed to whatever you set DocumentRoot to.
  24. #
  25. <Directory "X:/Server Soft/apache/htdocs">
复制代码



  1. <IfModule dir_module>
  2.     DirectoryIndex index.html index.htm
  3. </IfModule>
复制代码

改为
  1. DocumentRoot "X:/www"

  2. #
  3. # Each directory to which Apache has access can be configured with respect
  4. # to which services and features are allowed and/or disabled in that
  5. # directory (and its subdirectories).
  6. #
  7. # First, we configure the "default" to be a very restrictive set of
  8. # features.
  9. #
  10. <Directory />
  11. Options FollowSymLinks
  12. AllowOverride None
  13. Order deny,allow
  14. allow from all
  15. </Directory>

  16. #
  17. # Note that from this point forward you must specifically allow
  18. # particular features to be enabled - so if something's not working as
  19. # you might expect, make sure that you have specifically enabled it
  20. # below.
  21. #

  22. #
  23. # This should be changed to whatever you set DocumentRoot to.
  24. #
  25. <Directory "X:/www">
复制代码

  1. <IfModule dir_module>
  2. DirectoryIndex index.php index.html index.htm
  3. </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的末尾添加如下代码
  1. LoadModule fastcgi_module modules/mod_fcgid.so
  2. ScriptAlias /fcgi-php5/ "X:/Server Soft/php/"
  3. FastCgiServer "X:/Server Soft/php/php-cgi.exe" -processes 3
  4. # 说明:此处的 -processes 3 表示启动三个 php-cgi.exe 进程,
  5. # 关于 FastCgiServer 的详细参数请参考 FastCGI 文档。
  6. AddType application/x-httpd-fastphp5 .php
  7. Action application/x-httpd-fastphp5 "X:/Server Soft/php/php-cgi.exe"
复制代码
重启Apache

Step4:
把php目录下的php.ini-dist改名为php.ini(用recommended也可以),然后修改以下数据
  1. extension_dir = "."

  2. fastcgi.impersonate = 1

  3. cgi.fix_pathinfo=1

  4. cgi.force_redirect = 1

  5. ;extension=php_mbstring.dll

  6. ;extension=php_mcrypt.dll

  7. ;extension=php_dba.dll

  8. ;extension=php_dbase.dll

  9. ;extension=php_gd2.dll

  10. ;extension=php_mysql.dll

  11. ;extension=php_mysqli.dll

  12. short_open_tag = Off
复制代码
改为
  1. extension_dir = "X:\Server Soft\php\ext"

  2. fastcgi.impersonate = 1

  3. cgi.fix_pathinfo=1

  4. cgi.force_redirect = 0

  5. extension=php_mbstring.dll

  6. extension=php_mcrypt.dll

  7. extension=php_dba.dll

  8. extension=php_dbase.dll

  9. extension=php_gd2.dll

  10. extension=php_mysql.dll

  11. extension=php_mysqli.dll

  12. short_open_tag = On
复制代码

然后写个phpinfo.php,内容如下:
  1. <?
  2. phpinfo();
  3. ?>
复制代码
保存。拷贝到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~搞定
zhouhuan18 发表于 2011-7-10 19:42:02 | 显示全部楼层
Apache也是WEB服务器么
回复

使用道具 举报

 楼主| Noyskk 发表于 2011-7-11 00:07:47 | 显示全部楼层
对呀,你在Dz很久了,还不知道吗·?

回复

使用道具 举报

zhouhuan18 发表于 2011-7-11 18:54:34 | 显示全部楼层
知道,但是为什么要装2个WEB服务器呢?
回复

使用道具 举报

 楼主| Noyskk 发表于 2011-7-11 20:07:46 | 显示全部楼层
因为Kangle的性能比Apache好,Apache又比较稳定,自然要用Kangle做反向代理,Apache做后端处理。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-9-23 03:20 , Processed in 0.099006 second(s), 16 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表