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

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

主站蜘蛛池模板: 九九热免费在线视频 | 欧美在线 | 亚洲 | 91免费黄 | 精品一区二区毛片 | 国产精品aaa | 国产麻豆91视频 | 91爱爱视频 | 麻豆911| 国产精品自拍在线 | 亚洲男人天堂影院 | 一级片在线免费观看 | 亚洲乱码精品 | 欧美一级爆毛片 | 色婷婷久久五月综合成人 | 在线观看中文字幕一区 | 就操网| 91美女在线视频 | 精品国偷自产一区二区三区 | 禁漫天堂免费网站 | 91福利视频导航 | 91黄色免费版 | 欧美国产激情 | 亚洲成人精品久久久 | 亚洲最大福利网站 | 波多野结衣一区二区三区中文字幕 | www麻豆| 欧美成人aaa | 国产精品资源 | 国产主播av | 97在线观看免费视频 | 欧美黑人孕妇孕交 | 亚洲少妇第一页 | 国产69久久精品成人看 | 国内成人自拍视频 | av在线综合网 | 91美女在线视频 | 国产精品久久久久久久久借妻 | 农民人伦一区二区三区 | 精品一区91 | 中文字幕www | 国产精品免费入口 | 久久久99精品国产一区二区三区 | eeuss鲁片一区二区三区在线观看 | 午夜色片 | 婷婷国产一区 | 国产91亚洲精品 | 天天视频色 | 西西午夜视频 | 韩日精品在线 | 加勒比一区二区 | 国产ts人妖调教重口男 | 少妇人妻精品一区二区三区 | 激情网久久 | 美女吞精视频 | 亚洲av无一区二区三区 | 成人片黄网站久久久免费 | 亚洲欧洲综合网 | 日本女人毛片 | 免费黄色小视频 | 九九热这里有精品 | 亚洲裸体视频 | 色屁屁ts人妖系列二区 | 午夜老湿机 | 天天干夜夜欢 | 欧美激情图片 | 精彩毛片 | 欧美在线视频观看 | a级黄色影院 | 国产喷白浆一区二区三区 | 欧美激情中文字幕 | 亚洲自拍偷拍第一页 | 在线观看欧美国产 | 国产片在线| 91免费版在线 | 欧美精品在线播放 | 久久免费视频精品 | 无码不卡av东京热毛片 | 91亚洲网 | 午夜毛片视频 | 神宫寺奈绪一区二区三区 | 国产精品对白刺激久久久 | 黄色aaa视频 | 99re6在线观看| 国产啊啊啊啊 | 九九啪| 性欧美在线视频观看 | 日韩欧美有码 | 色六月婷婷 | 欧美最顶级a∨艳星 | 国产高潮在线观看 | 凹凸福利视频 | 叶山小百合av一区二区 | 欧美国产成人精品一区二区三区 | 国产男女爽爽爽 | 一级黄色视 | 国产精品99久久久 | 久色视频在线 | 老司机av导航 | 亚洲视频精品一区 |