呵呵!觉得有必要把今晚的装lighttpd的经验和过程给记录下来! 第一次写这样的文章,有什么不足的地方请高手们指出并给与修正!下面开始!

第一步:系统的安装! 菜鸟的朋友们,可以先去linux系统的初级教程,再来看我的文章!

跳过。我用的是CentOS5.5的!


二步:下载mysql并安装,地址是:http://www.mysql.com/downloads/mysql/5.1.html#downloads(需要用邮箱注册),现在最新版是                           5.1.54 的,我用的是5.0.56。

#  /usr/sbin/groupadd mysql

#  /usr/sbin/useradd   mysql  mysql

#  tar -xzvf  mysql-5.0.56.tar.gz

# cd  mysql-5.0.56

#./configure  --prefix=/opt/mysql   --with-ldflags-client=-all-static  --with-ldflags-mysqld=-all-static   --with-assembler  --with-unix-socket-path=/opt/mysql/tmp/mysql.sock    --with-thread-safe-client  --with-mysqld-user=mysql     -with-extra-charsets=utf8,gbk,gb2312     --with-charset=utf8              (还有很多参数,读者可以根据自己的实际需要,带上哪些参数)。

#make  &&  make  install

安装完成之后要做的事情:

1.拷贝mysql配置文件到/etc目录下,根据你的服务器的配置选择相应的配置文件,然后重名为my.cnf。

#cp  support-files/my-medium.cnf   /etc/my.cnf

2.建立初始化数据库:

#cd   /opt/mysql

#./bin/mysql_install_db

3.更改相关目录的权限:

# chown  -R   root   .

# chgrp    -R   mysql   .

# chown    -R   mysql   var

看看能不能启动起来:

#  /opt/mysql/bin/mysqld_safe --defaults-file=/etc/my.cnf &

第三步 :从lighttpd官方网站上下载lighttpd软件,下载地址是:

http://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-1.4.28.tar.gz

现在最新版本的是1.4.28的,下载下来之后对其进行解压:

# groupadd  lighttpd

#useradd  -s  /sbin/nologin  -M -g lighttpd  lighttpd

#tar  -xzvf  lighttpd-1.4.28.tar.gz

#cd lighttpd-1.4.28

#./configure  --prefix=/opt/lighttpd  --with-pcre    --with-openssl    --with-mysql=/opt/mysql/bin/mysql_config

# make && make install

 在第二步中要注意的有几点:

a、--with-pcre  :lighttpd需要pcre的支持,你要确定你的系统已经装了pcre和pcre-devel软件包!不然他会报错的!

#yum   install   pcre

#yum install pcre-devel

b、--with-openssl :这个参数根据你的需要选择加不是不加,如果需要ssl支持的话,那你要确定你的系统中已经装了openssl和openssl-devel。

#yum  install  openssl

#yum  install  openssl-devel

c、--with-mysql=/opt/mysql/bin/mysql_config  :  这个参数要特别注意,本人刚开始装的时候,误认为是mysql的安装目录,其实不是的,这里是mysql_config文件的路径。

d、如果你遇到了bzip2的错误,你再把bzip2和bzip2-devel两个软件包装上。

#yum install bzip2

#yum  install  bzip2-devel

除了上述几个错误,基本上没有其他错误了!即使有其他的错误,只要能看得懂上面的错误提示,也没有什么大问题!安装完成之后,需要拷贝几个文件:

#  cd  lighttpd-1.4.28/doc/config

#mkdir -p /opt/lighttpd/etc

#  cp  lighttpd.conf  /opt/lighttpd/etc/

#  cp  modules.conf  /opt/lighttpd/etc

# cp  -a  conf.d/  /opt/lighttpd/etc

# mkdir  -p /opt/lighttpd/run

# mkdir  -p  /opt/lighttpd/cache

# mkdir  -p  /opt/lighttpd/logs

# chown -R  lighttpd  /opt/lighttpd/

第四步:接下来,再安装php,下载地址是:http://cn.php.net/get/php-5.3.5.tar.gz/from/this/mirror,最新版的是5.3.5的,我用的是5.2.16                 的。安装php之前要做一些准备:(需要的软件包很多,因为我们不是实际应用,所以我有的软件包没提到)基本的几个软件包有                 以下几个:jpeg和jpeg-devel ,png  和png-devel,freetype和freetype-devel,libxml2和libxml2-devel,gd和gd-devel,libiconv,                  zlib和zlibdevel,mhash,libmcrypt等等。

可以用yum安装的几个就不讲了。下面几个编译安装的(有的可以不安装的!)

#  tar zxvf libiconv-1.13.tar.gz

#  cd libiconv-1.13/

# ./configure --prefix=/usr/local

#  make

#  make install

#   cd ../

#  tar zxvf libmcrypt-2.5.8.tar.gz

#  cd libmcrypt-2.5.8/

# ./configure

#  make  &&  make install

#  /sbin/ldconfig

#  cd libltdl/

# ./configure --enable-ltdl-install

#  make  &&  make install

#   cd http://www.cnblogs.com/

#   tar zxvf mhash-0.9.9.9.tar.gz

#  cd mhash-0.9.9.9/

# ./configure

# make  &&  make install

在php安装过程中报错的时候,看它是不是提示哪个包没有安装,如是这样的话,就缺哪个软件包就安装哪个咯!安装php:

# tar -xzvf php-5.2.16.tar.gz

给 php打个补丁(php-5.2.16-fpm-0.5.14.diff.gz:php进程管理器)下载地址:

http://php-fpm.org/downloads/php-5.2.16-fpm-0.5.14.diff.gz

#  gzip -cd php-5.2.16-fpm-0.5.14.diff.gz > patch -d php-5.2.16 -p1

# cd php-5.2.16

#  ./configure  --prefix=/opt/php --with-config-file-path=/opt/php/etc --with-mysql=/opt/mysql --with-mysqli=/opt/mysql/bin/mysql_config --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets

#  make  && make install

第五步:一些基本的配置:lighttpd 主配置文件lighttpd.conf文件的大致内容如下(红色代表修改过,蓝色代表要注意一下配置):

··································#######################################################################
##
## Some Variable definition which will make chrooting easier.
##
## if you add a variable here. Add the corresponding variable in the
## chroot example aswell.
##var.log_root    = "/opt/lighttpd/logs"
var.server_root = "/opt/lighttpd"
var.state_dir   = "/opt/lighttpd/run"
var.home_dir    = "/opt/lighttpd"
var.conf_dir    = "/opt/lighttpd/etc"##
## Some additional variables to make the configuration easier
####
## Base directory for all virtual hosts
##
## used in:
## conf.d/evhost.conf
## conf.d/simple_vhost.conf
## vhosts.d/vhosts.template
##var.vhosts_dir  = server_root + "/vhosts"##
## Cache for mod_compress
##
## used in:
## conf.d/compress.conf
##var.cache_dir   = "/opt/lighttpd/cache"##
## Base directory for sockets.
##
## used in:
## conf.d/fastcgi.conf
## conf.d/scgi.conf
##var.socket_dir  = home_dir + "/sockets"##
##############################################################################################################################################
##
## Load the modules.include "modules.conf"##
##############################################################################################################################################
##
##  Basic Configuration
## ---------------------
##server.port = 88##
## Use IPv6?
##
##server.use-ipv6 = "enable"##
## bind to a specific IP
##server.bind = "192.168.1.2"##
## Run as a different username/groupname.
## This requires root permissions during startup.
##server.username  = "lighttpd"
server.groupname = "lighttpd"##
## enable core files.
##
#server.core-files = "disable"##
## Document root
##server.document-root = server_root + "/htdocs"##
## The value for the "Server:" response field.
##
## It would be nice to keep it at "lighttpd".
##
#server.tag = "lighttpd"##
## store a pid file
##server.pid-file = state_dir + "/lighttpd.pid"##
##############################################################################################################################################
##
##  Logging Options
## ------------------
##
## all logging options can be overwritten per vhost.
##
## Path to the error log file
##server.errorlog             = log_root + "/error.log"##
## If you want to log to syslog you have to unset the
## server.errorlog setting and uncomment the next line.
##
#server.errorlog-use-syslog = "enable"##
## Access log config
##include "conf.d/access_log.conf"##
## The debug options are moved into their own file.
## see conf.d/debug.conf for various options for request debugging.
##include "conf.d/debug.conf"##
##############################################################################################################################################
##
##  Tuning/Performance
## --------------------
##
## corresponding documentation:
## http://www.lighttpd.net/documentation/performance.html
##
## set the event-handler (read the performance section in the manual)
##
## possible options on linux are:
#### select
## poll
## linux-sysepoll
##
## linux-sysepoll is recommended on kernel 2.6.
##
server.event-handler = "linux-sysepoll"####
server.network-backend = "linux-sendfile"##
server.max-fds = 2048##
## Stat() call caching.
##
## lighttpd can utilize FAM/Gamin to cache stat call.
##
## possible values are:
## disable, simple or fam.
##
server.stat-cache-engine = "simple"##
## Fine tuning for the request handling
##
## max-connections == max-fds/2 (maybe /3)
## means the other file handles are used for fastcgi/files
##server.max-connections = 1024##
## How many seconds to keep a keep-alive connection open,
## until we consider it idle.
##
## Default: 5
###server.max-keep-alive-idle = 5index-file.names += ("index.xhtml", "index.html", "index.htm", "default.htm", "index.php"
)##
## deny access the file-extensions
##
## ~    is for backupfiles from vi, emacs, joe, ...
## .inc is often used for code includes which should in general not be part
##      of the document-root
url.access-deny             = ( "~", ".inc" )##
## disable range requests for pdf files
## workaround for a bug in the Acrobat Reader plugin.
####$HTTP["url"] =~ "\.pdf$" {
##  server.range-requests = "disable"
##}##
## url handling modules (rewrite, redirect)
##
## defaults to /var/tmp as we assume it is a local harddisk
##server.upload-dirs = ( "/var/tmp" )##
##############################################################################################################################################
##
##  SSL Support
## -------------
##
#

····························

对modules.conf要取消需要用到模块的注释,mod_rewrite,mod_access,mod_fastcgi,

mod_simple_vhost,mod_cgi,mod_compress,mod_accesslog是一般需要用到的。modules.conf文件内容如下:

#######################################################################
##
##  Modules to load
## -----------------
##
## at least mod_access and mod_accesslog should be loaded
## all other module should only be loaded if really neccesary
##
## - saves some time
## - saves memory
##
## the default module set contains:
##
## "mod_indexfile", "mod_dirlisting", "mod_staticfile"
##
## you dont have to include those modules in your list
##
## Modules, which are pulled in via conf.d/*.conf
##
## NOTE: the order of modules is important.
##
## - mod_accesslog     -> conf.d/access_log.conf
## - mod_compress      -> conf.d/compress.conf
## - mod_status        -> conf.d/status.conf
## - mod_webdav        -> conf.d/webdav.conf
## - mod_cml           -> conf.d/cml.conf
## - mod_evhost        -> conf.d/evhost.conf
## - mod_simple_vhost  -> conf.d/simple_vhost.conf
## - mod_mysql_vhost   -> conf.d/mysql_vhost.conf
## - mod_trigger_b4_dl -> conf.d/trigger_b4_dl.conf
## - mod_userdir       -> conf.d/userdir.conf
## - mod_rrdtool       -> conf.d/rrdtool.conf
## - mod_ssi           -> conf.d/ssi.conf
## - mod_cgi           -> conf.d/cgi.conf
## - mod_scgi          -> conf.d/scgi.conf
## - mod_fastcgi       -> conf.d/fastcgi.conf
## - mod_proxy         -> conf.d/proxy.conf
## - mod_secdownload   -> conf.d/secdownload.conf
## - mod_expire        -> conf.d/expire.conf
##server.modules = ("mod_access","mod_alias","mod_auth","mod_evasive","mod_redirect","mod_rewrite","mod_setenv","mod_usertrack",)##
##############################################################################################################################################
##
##  Config for various Modules
##

·····························

配置lighttpd和php和通信(fastcgi):

# vi /opt/lighttpd/etc/conf.d/fastcgi.conf

#######################################################################

##
##  FastCGI Module
## ---------------
##
## http://www.lighttpd.net/documentation/fastcgi.html
##
server.modules += ( "mod_fastcgi" )##
## PHP Example
##For PHP don't forget to set cgi.fix_pathinfo = 1 in the php.ini.##
## The number of php processes you will get can be easily calculated:

·······················

······················

## chrooted webserver + external PHP
##
## $ spawn-fcgi -f /usr/bin/php-cgi -p 2000 -a 127.0.0.1 -C 8
##
## webserver chrooted to /srv/www/
## php running outside the chroot
fastcgi.server = ( ".php" => (( "host" => "127.0.0.1","port" => "9000","docroot" => "/opt/lighttpd/htdocs/")))#server.chroot = "/opt/lighttpd"
#server.document-root = "/opt/lighttpd/htdocs/"
###
#######################################################################

载自:http://hi.baidu.com/keguichao/blog/item/e8fcb810c424a2d4a6ef3f64.html

转载于:https://www.cnblogs.com/chenwenbiao/archive/2011/08/01/2124020.html

CentOS+lighttpd+php+mysql (fastcgi)环境的搭建(转)相关推荐

  1. (三)Linux环境部署(Centos+Nginx+Tomcat+Mysql) - Nginx环境搭建

    因为在网上发现系统性.严谨(特别是在安全方面)的Linux部署方面的参考文章很少,于是整理以下六篇Linux环境部署的系列性文章,其为本人在实践中,完整的搭建一个基于Linux系统上Centos+Ng ...

  2. CentOS+Nginx+Tomcat+Mysql+PHP 环境搭建及系统部署

    ==============安装centos 7.0======================= 选择最小安装,将相关的"调试工具"."兼容性程序库".&qu ...

  3. 搭建nginx + python + django +memcached+ mysql +fastcgi 环境

    Django是一个开放源代码的Web应用框 架,由Python写成,它最初是被开发来用于管理劳伦斯出版集团旗下的一些以新闻内容为主的网站的.python+django也是web开发者最受欢 迎的框架. ...

  4. centos apache php mysql zend_CentOS 5.5搭建Apache+PHP5.2x+MySQL5+Zend3(yum安装)

    一.替换CentOS镜像服务器,修改CenOS-Base.repo中国官方镜像网站:http://centos.ustc.edu.cn 修改CentOS: cd /etc/yum.repos.d mv ...

  5. jmeter线程说明_4.centos下Jmeter+InfluxDB+Grafana环境的搭建1

    如果这些内容对你有帮助,也可以打开微信扫一扫,加关注: 一.前言 本文中influxdb和Grafana下载.安装.配置及使用见另外3篇文章: 1.Influxdb使用1 2.Influxdb使用2 ...

  6. php70w mysql.x8664_LAMP环境的搭建(三)----PHP7的安装

    centos自带的PHP源是5.4版本的.如果需要安装PHP 5.4 直接输入 yum install php -y 即可 因为PHP7性能巨大的提升,因此本文选择安装PHP7 如果已经安装过了php ...

  7. win7 32 php+mysql+apache环境_win7 搭建PHP环境(php+mysql+apache)

    因为一个小需求决定尝试一下php程序开发, php版本(版本需明视,清楚是所需是VC6还是VC9,Apache,so,VC6):php-5.3.1-Win32-VC6-x86.zip; mysql:m ...

  8. (六)Linux环境部署(Centos+Nginx+Tomcat+Mysql) - 常用命令总结

    因为在网上发现系统性.严谨(特别是在安全方面)的Linux部署方面的参考文章很少,于是整理以下六篇Linux环境部署的系列性文章,其为本人在实践中,完整的搭建一个基于Linux系统上Centos+Ng ...

  9. (四)Linux环境部署(Centos+Nginx+Tomcat+Mysql) - 安装Tomcat和JDK 以及 Nginx与Tomcat整合

    因为在网上发现系统性.严谨(特别是在安全方面)的Linux部署方面的参考文章很少,于是整理以下六篇Linux环境部署的系列性文章,其为本人在实践中,完整的搭建一个基于Linux系统上Centos+Ng ...

最新文章

  1. python读取csv文件第一行_尝试读取CSV文件的第一行返回['/']
  2. html从入门到卖电脑(六)
  3. Java 字节数组(byte[])和整型(int)的相互转换
  4. 3.1_栈_顺序存储结构(数组形式)
  5. if you want to buy something
  6. 性能测试(04)-表达式和业务关联-JDBC关联
  7. oracle exp 乱码 942,Oracle exp/imp字符集相关问题
  8. Python之路【第一篇】:环境搭建
  9. 必知必会!常用矩阵求导和重要的矩阵
  10. java中怎么判断返回200_java – 从Spring REST API返回HTTP代码200
  11. 我的java编程之路小小总结感想
  12. 【纪念】NOIP2018前夕——一些想说的话
  13. 素数筛(快速筛)-爱拉托斯特尼筛法+欧拉筛
  14. 《非暴力沟通》- 使人情意相通的沟通方式
  15. 如何在markdown中打出上标、下标和一些特殊符号 from jianshuer 这是朕的江山
  16. 裸机运行c语言,裸机_GPIO实验_C语言
  17. 前辈们的网络攻城狮心得
  18. MFC画带箭头的直线
  19. vs2019 预览版发行说明--转载自微软官网(不定期转载更新)
  20. 滴滴java开发面试题_滴滴出行(小桔科技)亲身面试经验分享,java开发岗

热门文章

  1. 网络知识:各种缓存核心知识整理,值得收藏!
  2. java 布尔表达式_java - 布尔值,条件运算符和自动装箱
  3. Android相对布局(RelativeLayout)常用属性、练习使用按键、文本框等控件、线性布局(LinearLayout)属性
  4. mp3 pcm java_Java mp3文件转pcm文件
  5. c++ 获取数组的长度
  6. java中System.exit(1)、System.exit(0)、以及return的区别
  7. shields 徽标_徽标不够用时如何设计应用程序图标
  8. ios 按钮图片充满按钮_iOS有一些非常危险的按钮-UX评论
  9. 面对 this 指向丢失,尤雨溪在 Vuex 源码中是怎么处理的
  10. 若川的2016年度总结,毕业工作