久久狠狠色噜噜狠狠狠狠97|国产成人久久精品麻豆二区|精品精拍国产日韩26u|色偷偷亚洲第一综合网

始創(chuàng)于2000年 股票代碼:831685
咨詢熱線:0371-60135900 注冊(cè)有禮 登錄
  • 掛牌上市企業(yè)
  • 60秒人工響應(yīng)
  • 99.99%連通率
  • 7*24h人工
  • 故障100倍補(bǔ)償
全部產(chǎn)品
您的位置: 網(wǎng)站首頁(yè) > 幫助中心>文章內(nèi)容

Ubuntu8.04快速搭建nginx+php系統(tǒng)

發(fā)布時(shí)間:  2012/8/13 11:38:44
 昨天在FreeBSD下玩了nginx+php,今天到ubuntu下來(lái)玩玩了,首先要感謝“過(guò)夠了”的文章以下是按他的文章修改而來(lái)。在ubuntu下搭建比f(wàn)reebsd下速度要快得多,因?yàn)樵趂reebsd我是用ports方式安裝,需要編譯,ubuntu下直接apt-getinstall的方式安裝,速度很快,下面就來(lái)開(kāi)始安裝吧!

1,安裝nginx,執(zhí)行以下命令,很快完成,不過(guò)目前apg-get方式安裝默認(rèn)是0.5.33的版本

sudoapt-getinstallnginx

配置文件默認(rèn)安裝位置:

conf:/etc/nginx/nginx.conf
bin:/usr/sbin/nginx
vhost:/etc/nginx/sites-enable/default
cgi-params:/etc/nginx/fastcgi-params

例:建一個(gè)虛擬Server

server{
listen80;
server_namewww.23day.com;
access_log/var/log/nginx/home.ucenter.access.log;

location/{
root/var/www/23day.com;
indexindex.php;

location~\.php${
fastcgi_pass127.0.0.1:9000;
fastcgi_indexindex.php;
fastcgi_paramSCRIPT_FILENAME/var/www/23day.com$fastcgi_script_name;
include/etc/nginx/fastcgi_params;
}
}

2,安裝php-cgi模塊

執(zhí)行sudoapt-getinstallphp5-cgi

配置文件默認(rèn)安裝位置:

php-cgi:/usr/bin/php-cgi
php5-cgi:/usr/bin/php5-cgi
cgiconfig:/usr/bin/cgi/php.ini

修改php.ini文件的cgi.fix_pathinfo數(shù)據(jù)為1,默認(rèn)為0cgi.fix_pathinfo=1;這樣php-cgi方能正常使用SCRIPT_FILENAME這個(gè)變量


3,安裝spawn-fcgispawn-fcgi是lighttpd的一個(gè)用來(lái)控制php-cgi的工具.

如果系統(tǒng)沒(méi)有安裝GCC編譯環(huán)境,剛需要在安裝lighttpd之前要安裝build-essential工具包,執(zhí)行以下命令

sudoapt-getinstallbuild-essential
wgethttp://www.lighttpd.net/download/lighttpd-1.4.19.tar.gz
tar-xvflighttpd-1.4.19.tar.gz
cdlighttpd-1.4.19/
sudoapt-getinstalllibpcre3-dev
./configure–without-zlib–without-bzip2
make
sudocpsrc/spawn-fcgi/usr/local/bin/spawn-fcgi

這樣cgi控制器就安裝完成.

4.啟動(dòng)測(cè)試系統(tǒng).啟動(dòng)fast_cgi:

spawn-fcgi-a127.0.0.1-p9000-C5-uwww-data-gwww-data-f/usr/bin/php-cgi

注意:ip,端口與nginx服務(wù)器中的cgi-pass要對(duì)應(yīng).-C表示打開(kāi)幾個(gè)cgi進(jìn)程

啟動(dòng)nginx

sudo/etc/init.d/nginxstart

好了,如果沒(méi)有出錯(cuò)信息,則說(shuō)明配置成功了,現(xiàn)在寫(xiě)個(gè)phpinfo測(cè)試下吧!

最后,附上我的/etc/nginx/sites-enable/default的配置文件,此配置文件啟用了rewrite功能

server{
listen80;
server_namelocalhost;

access_log/var/log/nginx/localhost.access.log;

location/{
root/var/www/nginx-default;
indexindex.php;

if(-f$request_filename/index.html){
rewrite(.*)$1/index.htmlbreak;
}
if(-f$request_filename/index.php){
rewrite(.*)$1/index.php;
}
if(!-f$request_filename){
rewrite(.*)/index.php;
}

}

#error_page404/404.html;

#redirectservererrorpagestothestaticpage/50x.html
#
error_page500502503504/50x.html;
location=/50x.html{
root/var/www/nginx-default;
}

#proxythePHPscriptstoApachelisteningon127.0.0.1:80
#
#location~\.php${
#proxy_passhttp://127.0.0.1;
#}

#passthePHPscriptstoFastCGIserverlisteningon127.0.0.1:9000
#
location~\.php${
fastcgi_pass127.0.0.1:9000;
fastcgi_indexindex.php;
fastcgi_paramSCRIPT_FILENAME/var/www/nginx-default$fastcgi_script_name;
include/etc/nginx/fastcgi_params;
}

#denyaccessto.htaccessfiles,ifApache’sdocumentroot
#concurswithnginx’sone
#
#location~/\.ht{
#denyall;
#}
}

#anothervirtualhostusingmixofIP-,name-,andport-basedconfiguration
#
#server{
#listen8000;
#listensomename:8080;
#server_namesomenamealiasanother.alias;

#location/{
#roothtml;
#indexindex.htmlindex.htm;
#}
#}

#HTTPSserver
#
#server{
#listen443;
#server_namelocalhost;

#sslon;
#ssl_certificatecert.pem;
#ssl_certificate_keycert.key;

#ssl_session_timeout5m;

#ssl_protocolsSSLv2SSLv3TLSv1;
#ssl_ciphersALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
#ssl_prefer_server_cipherson;

#location/{
#roothtml;
#indexindex.htmlindex.htm;
#}
#}


本文出自:億恩科技【www.yaz797.com】

服務(wù)器租用/服務(wù)器托管中國(guó)五強(qiáng)!虛擬主機(jī)域名注冊(cè)頂級(jí)提供商!15年品質(zhì)保障!--億恩科技[ENKJ.COM]

  • 您可能在找
  • 億恩北京公司:
  • 經(jīng)營(yíng)性ICP/ISP證:京B2-20150015
  • 億恩鄭州公司:
  • 經(jīng)營(yíng)性ICP/ISP/IDC證:豫B1.B2-20060070
  • 億恩南昌公司:
  • 經(jīng)營(yíng)性ICP/ISP證:贛B2-20080012
  • 服務(wù)器/云主機(jī) 24小時(shí)售后服務(wù)電話:0371-60135900
  • 虛擬主機(jī)/智能建站 24小時(shí)售后服務(wù)電話:0371-60135900
  • 專(zhuān)注服務(wù)器托管17年
    掃掃關(guān)注-微信公眾號(hào)
    0371-60135900
    Copyright© 1999-2019 ENKJ All Rights Reserved 億恩科技 版權(quán)所有  地址:鄭州市高新區(qū)翠竹街1號(hào)總部企業(yè)基地億恩大廈  法律顧問(wèn):河南亞太人律師事務(wù)所郝建鋒、杜慧月律師   京公網(wǎng)安備41019702002023號(hào)
      0
     
     
     
     

    0371-60135900
    7*24小時(shí)客服服務(wù)熱線