亚洲乱码午夜理论不卡公息肉欲_无遮挡一级毛片在线播放_国产AV无码国产永久播放_中出欧美美脚在线观看

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

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

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

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

sudoapt-getinstallnginx

配置文件默認安裝位置:

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

例:建一個虛擬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

配置文件默認安裝位置:

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,默認為0cgi.fix_pathinfo=1;這樣php-cgi方能正常使用SCRIPT_FILENAME這個變量


3,安裝spawn-fcgispawn-fcgi是lighttpd的一個用來控制php-cgi的工具.

如果系統(tǒng)沒有安裝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.啟動測試系統(tǒng).啟動fast_cgi:

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

注意:ip,端口與nginx服務器中的cgi-pass要對應.-C表示打開幾個cgi進程

啟動nginx

sudo/etc/init.d/nginxstart

好了,如果沒有出錯信息,則說明配置成功了,現(xiàn)在寫個phpinfo測試下吧!

最后,附上我的/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.ruiliheng.com】

服務器租用/服務器托管中國五強!虛擬主機域名注冊頂級提供商!15年品質(zhì)保障!--億恩科技[ENKJ.COM]

  • 您可能在找
  • 億恩北京公司:
  • 經(jīng)營性ICP/ISP證:京B2-20150015
  • 億恩鄭州公司:
  • 經(jīng)營性ICP/ISP/IDC證:豫B1-20183354
  • 億恩南昌公司:
  • 經(jīng)營性ICP/ISP證:贛B2-20080012
  • 服務器/云主機 24小時售后服務電話:0371-60135900
  • 虛擬主機/智能建站 24小時售后服務電話:0371-60135900
  • 網(wǎng)絡版權(quán)侵權(quán)舉報電話:0371-60135995
  • 警情提示:注意防范電信網(wǎng)絡詐騙
  • 專注服務器托管17年
    掃掃關注-微信公眾號
    0371-60135900
    Copyright© 1999-2026 ENKJ All Rights Reserved 地址:鄭州市高新區(qū)翠竹街1號總部企業(yè)基地億恩大廈  法律顧問:河南亞太人律師事務所郝建鋒、杜慧月律師  B1-20183354   京公網(wǎng)安備41019702002023號 
      1
     
     
     
     

    0371-60135900
    7*24小時客服服務熱線