手机版
你好,游客 登录 注册
背景:
阅读新闻

Apache+Fastcgi模块+APC经典配置

[日期:2012-06-10] 来源:Linux社区  作者:wgkgood [字体:大 中 小]

前言 * FastCGI是一个程序接口,它能加速公共网关接口(CGI),CGI是一种用最常见的方式使Web服务器调用应用程序的Web应用程序。按一个FastCGI工具来看,用户要求进入一个网站并使用一个专门的应用软件的话,使用FastCGI能够快3到30倍。FastCGI是Web服务器的一种插件。

一、安装apache fastcgi模块:

  1. 下载地址:http://down.51cto.com/data/139939 (51cto下载中心)  
  2.  
  3. tar -zxvf mod_fastcgi-current.tar.gz  
  4.  
  5. cd mod_fastcgi  
  6. cp Makefile.AP2 Makefile  
  7. vi Makefile 修改top_dir=/usr/local/apache2  #你的apache安装路径或者直接编(apache2.0已经安装)  
  8. make  
  9. make install(这里采用apache而不采用nginx的原因是:虽然nginx有很多优点,但是对于大部分中小型网站来说,apache经过优化可以满足访问要求。)

二、安装MYSQL

  1. tar -zxvf mysql-5.0.75.tar.gz  //解压  
  2. cd mysql-5.0.75  
  3.  ./configure --prefix=/usr/local/mysql --with-charset=gbk --with-extra-charsets=all 
  4. make  
  5. make install  
  6. groupadd mysql  //创建组mysql  
  7. useradd -g mysql mysql  //创建mysql用户,把mysql加入到mysql组  
  8.  
  9. cd /usr/local/mysql/  
  10. cp share/mysql/my-medium.cnf  /etc/my.cnf  
  11.  
  12. cp share/mysql/mysql.server /etc/init.d/mysqld  
  13.  
  14. (以上是把mysql加入系统服务)  
  15.  
  16.  chown -R mysql.mysql /usr/local/mysql  
  17.  /usr/local/mysql/bin/mysql_install_db --user=mysql  //初始化数据库  
  18.  chown -R mysql.mysql /usr/local/mysql/var  
  19.  /usr/local/mysql/bin/mysqld_safe --user=mysql &  //启动数据库(或者 service mysqld restart) 

三、安装php-fpm
在安装PHP-FPM编译的时候会报找不到libevent,可以执行

  1. yum -y install libevent*  
  2. wget http://www.monkey.org/~provos/libevent-1.4.12-stable.tar.gz  
  3. tar zxvf libevent-1.4.12-stable.tar.gz  
  4. cd libevent-1.4.12  
  5. ./configure --prefix=/usr/local/libenent  
  6. mak && make install
  1. tar -jxvf php-5.3.3.tar.bz2  
  2. cd php-5.3.3  
  3. ./configure \  
  4. --prefix=/usr/local/php5 --with-config-file-path=/usr/local/php5/etc \  
  5. --with-mysql=/usr/local/mysql/ --with-mysqli=/usr/local/mysql/bin/mysql_config \  
  6. --with-zlib --with-curl --with-jpeg-dir --with-freetype-dir --with-png-dir \  
  7. --with-libxml-dir=/usr/ --with-gd  --with-openssl  \  
  8. --with-openssl --with-ldap --with-ldap-sasl --with-xmlrpc --without-pear \  
  9. --enable-xml --enable-gd-native-ttf \  
  10. --enable-ctype --enable-calendar --enable-inline-optimization \  
  11. --enable-magic-quotes --with-bz2 --enable-mbstring \  
  12. --enable-fpm  --enable-safe-mode  --enable-bcmath  --enable-shmop \  
  13. --enable-sysvsem --enable-mbregex  --enable-mbstring --enable-pcntl  \  
  14. --enable-zip --enable-ftp --enable-sockets --enable-soap --with-libevent-dir=/usr/local/libevent/  
  15. make && make install  
  16.  
  17. cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm  
  18. chmod +x /etc/init.d/php-fpm  
  19.  
  20. cp -r sapi/fpm/php-fpm.conf /usr/local/php5/etc/ 

启动php-fpm
/etc/init.d/php-fpm start
此时启动应该会报错,说php-fpm.conf配置文件中很多选项没有打开,只要按照它的提示打开就OK。

linux
相关资讯       Apache配置 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款