日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

CentOS+lighttpd+php+mysql (fastcgi)环境的搭建(转)

發布時間:2023/12/9 数据库 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 CentOS+lighttpd+php+mysql (fastcgi)环境的搭建(转) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

?? ? ??呵呵!覺得有必要把今晚的裝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_rewritemod_accessmod_fastcgi

mod_simple_vhostmod_cgimod_compressmod_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)环境的搭建(转)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 国产av无码专区亚洲a∨毛片 | 天天操夜夜撸 | 91av短视频| av片一区二区| 玖玖爱这里只有精品 | 特级新鲜大片片 | 国产黄色片免费看 | 欧美激情片一区二区 | 美女在线播放 | 青青草免费公开视频 | 中国黄色大片 | 美女被c出白浆 | 日韩福利视频 | 777色婷婷| 精品一区二区久久 | 国产伦精品一区二区. | 我要色综合天天 | 国产高潮在线 | 国产欧美视频一区 | 97超碰在线免费观看 | 麻豆一区二区在线 | 日韩高清不卡在线 | 午夜片在线观看 | 国产精品第一页在线观看 | 特级淫片裸体免费看 | 青青草污| 国产999精品久久久久久 | 久久无码视频网站 | 人与性动交zzzzbbbb | 国产盗摄精品一区二区酒店 | 疯狂伦交| 在线免费观看a视频 | 熟妇人妻精品一区二区三区视频 | 日韩欧美猛交xxxxx无码 | 亚洲国产无线乱码在线观看 | 久久亚洲av成人无码国产电影 | 中文字幕一区二区三区人妻在线视频 | jzzijzzij亚洲成熟少妇在线观看 久久久精品人妻一区二区三区 | 国产视频中文字幕 | 午夜视频免费观看 | 11孩岁女毛片 | 欧美在线一区二区 | 欧美一级特黄视频 | 欧洲av一区二区 | 九九99精品| 国产在线超碰 | 国产欧美精品久久 | 成人在线午夜 | 免费一级淫片aaa片毛片a级 | 欧美日韩国产激情 | 自拍偷拍亚洲综合 | 国产精品一区二区精品 | 国产美女自拍视频 | 制服师生在线 | 姐姐你真棒插曲快来救救我电影 | 99成人在线视频 | 九九久视频| 欧美用舌头去添高潮 | 色女人天堂 | 日韩九九九| 国产深喉视频一区二区 | 黄色成人在线播放 | 国产二区精品视频 | 亚洲一区小说 | 天天色综 | 99久久综合网 | 99av视频 | 私密视频在线观看 | 日韩欧美国产一区二区三区在线观看 | 成人青青草| 亚洲黄色在线免费观看 | 爱爱免费视频 | 国产精品视频全国免费观看 | 日韩理论在线观看 | 国产亚洲精品久久久久四川人 | 久久大| 最好看的中文字幕国语电影mv | 国产污视频在线观看 | 国产欧美视频在线播放 | 92久久 | 亚洲欧美在线看 | 性插动态视频 | www.婷婷色| 亚洲涩涩网 | 亚洲欧美日本韩国 | 色在线看 | 欧美三级午夜理伦 | 在线天堂中文字幕 | 久久精品国产视频 | 亚洲精品乱码久久久久久写真 | 九九精品在线观看 | 国产精品成人aaaaa网站 | 真实乱视频国产免费观看 | 办公室荡乳欲伦交换bd电影 | 女人毛片视频 | 国产一级二级av | 末路1997全集免费观看完整版 | 午夜秋霞影院 | 狠狠操导航 |