• m Linux pЉ|
    osGAзR firefox s
    | cD | ̔D | g | A | ~R | ୱR | w޲z | QAO | Ŏ | y`~ | m | Xs |
    @ @ @
    @
    ̪sG2011/08/05
    ڭ̳̱`y[zNO[]@ Web TI򤰻O Web OHNOyTsN (World Wide Web)AΪ̤]iH٤saIoӬOڭ̥ثeH̱`ϥΪ Internet w@TIq`WNOϥ WWW ӬdߨϥΪ̩һݭnToIثeb Unix-Like t WWW ADnNOzL Apache oӦAnӹFA ӬFʺAAO LAMP (Linux + Apache + MySQL + PHP) No򲣥TIڭԒӶiJ LAMP @ɧaI


    jADϥ20.1 WWW ̔vB귽HΦAn

    AD|oyܡHO WWW yTCb 1993 ~kAm즸^IJA Sɪ]jyNO@Ǹ귽U FTP HΫܦhr]PQA BBS FC MIALA`O\o֤FICӤWFsҡAFҷ~ݭnA g`sWxWN (TANET) i@ǎNƪ˯ASɤjO 1996 ~kC ]WNOnƦӤwAҥHNCCܤ֨ϥκFC

    LFX~AAϥιϧΤ@~tAMo{unIXӤpsAN|ܦhW񪺤rPϮסA ƦܴѼvSġASɯuOSYILAѩϧμv^\譱n BBS ¤rƧlޤHA۵MyܦhHwysbںWAHhSMNEIѩ_fi~A~ 90 ~NsjxAoӉη~jx]y WWW AǤQYsҤ䴩GC

    oǦ~ѩjM޻@BӤHx (blog)Bs (Ҧp facebook )BzEΪyASNںVt@ӷsɡI[I nFuOܦh[@_@CUڭ̨AAO WWW HΥLһݭnAnAR@s}TaI


    pADϥ20.1.1 WWW ̔vBHTML PAǨq (W3C)

    ں (TCP/IP) |o]ADnO 80 ~N email H 90 ~N᪺ WWW AȩҳyIרO WWW oӪNC WWW O World Wide Web YgA䤤 Web sNsbA ҥH̔٬yTNOFCWWW iHXrBϧΡBv^HnΦhCAózLiHƹI@Ws (Hyperlink) 覡NTH Internet ǻ@ɦUBhC

    PLAAAnsW WWW ɡAMݭnѤ@ǸơA ӧAΤݫhݭnϥΥiHRoǸƪnӳBzANOsTI̔xӻAAiHo@@@ WWW server/client }ʡG

    WWW APΤssu}
    20.1-1BWWW APΤssu}

    qWϥSAڭ̤jyiHo@[G

    • WWW Aݭn@ӥiΤsxARݭnѥΤݤ@ǸƤ~I
    • AҴѪ̥DnƬOWAһy (Hyper Text Markup Language, HTML)BhCɮ (ϤBv^BnBrΡAݩhCκ٬WC)C
    • HTML uO@ǯ¤rơAzLҿתA (<tag>) ӳWdҭnܪƮ榡F
    • bΤݡAzLs HTML HΦhC骺RA̫e{bϥΪ̪݁WC


    • HTML 榡

    pWҴ쪺}TAڭ̪DAݻݭnѥΤݤ@ǸơAӳoǸƨDnH HTML 榡ӧe{C򤰻O HTML OHڭ̮mӬݤ@UnFCAiHϥΥ@ss http://www.okfdzs1903.comAMbWWUƹkgA ԎݭlXAANo{MOpgFC

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-TW" lang="zh-TW">
    <head>
    ....@ǦTAYơAҦp title PƳ]pΆ....
    </head>
    <body style="margin:0; padding:0">
    ....bsܪeAکmbsWƫhg....
    </body>
    </html>
    

    HTML ҥHQ٬AһyNpPWҥܡALOѫܦh <tag> œAF <!DOCTYPE> ObŧiUykRMβĴX HTML R~AHTML DnO <html> </html> ҥ]t_ӡA Ӧb䤤Sj϶A@ӬOPAY} <head> </head> ϶A ]AMҨϥΪsX榡PYΆΡCt@hO <body> </body> ҧtںeTC

    HTML b媺AAiHbWܦh}yCӶDž HTML 4 ڤWwgHYǬuHε{]pvݨDA]AثeRﵽ HTML ܪ CSS ˦A iHܦh{ۨΪ XMLAR̷s@N HTML5 ΆΡAȱoѦҳC


    • WWW ҥΪw WWW A̔v--NOjɶ

    DF WWW server/client [cAAӧڭ̭nQAOA WWW OӪ[H BǴ- (Tim Berners-Lee) b 1980 ~NF󦳮IJvڬw֤lzǪaiHɤΧsL̪sGA OLoiX@WljKw (Hyper Text Transport Protocol, HTTP)C pPe쪺AboӨwWAݭnnAӥΤݫhݭnsӶRAҴѪơC odznӪH

    F HTTP oӨwoHQRΡAjb 90 ~NѥQդjaWŹqRΤ (NCSA, http://www.ncsa.illinois.edu/) }oXA HTTPd (HTTP daemon N)CHTTPd ۥѳnAҥHܧ֪ZfF WWW AC ӺqT (Netscape) }oXjjAP۹RΤsANOjagx Netscape oMnTCoMnAPsA䤤s۹KyALAiNQ~HFC ҥHAbAWDnROH HTTPd DC

    ӥѩ HTTPd oӦA@SoiAO@ssBͫKo_@ӭpeAoӭpeDnbﵽ쥻 HTTPd AnAL̺ٳoӧ}Ln鬰 ApacheAy@ӭ׭ק諸A (A patch server)zU}yI ^_^Io Apache b 1996 ~HK WWW AWv@nF (http://httpd.apache.org/)C


    • s (browser) jxP䴩A

    M WWW VӶVnA۹諸ӻAΤݦpGSsܨLSMNLkhs WWW AҴѪơCFmsvAOb 90 ~NLnN IE sئb Windows @~tA@Mw]SɬSsxϥΪ Netscape s (Navigator) vtUC Ӻqb 1998 ~kNslX}񦨬ۥѳnAĥ Mozilla qαv (MPL) C

    Mozilla (http://www.mozilla.org/) oӭpeҶ}onisӤwAR]AlBznκsnΆΡC SMTA䤤̥XWNOsnyW (firefox)zTIoNP IE ԣPH ѩ IE OXb Windows @~t֤ߤA [W睊TפӺCAƦ IE ϥΪ HTML AǻykR欰OLnۭqAǡA äMŦXںWAdzWd (W3C, http://www.w3.org/)AfPAݩҴѪƨõLkbҦsWܥXۦP˦A ӥBΤݤ]e@C

    firefox (http://moztw.org/) oiNA]pӬA]{SpAҥHįWD`ֳtA~AW󪺶RWA firefox Dn̾ w3c ҨqAǨӵoiAҥHH w3c AǶ}oAb firefox WN^o]p̩ҧƱ檺˦Iثe firefox wgw參W̱`쪺 Windows/Linux/Unix Χ@~tӶi䴩AjaiHhhϥγI^_^

    ӬF[ javascript {B@AåB[stסAGoogle ۤv]X@sA٬ chrome sA osNp google jM޻@@AjժNOֳtIֳtIֳtI]ApGAQnsnA NO̔Ajճt׷PA google o chrome ۥѳns]iHI

    ѤWڭ̥iHyLkǤ@UG

    • WWW O̾ HTTP oӨwӨӪAAݻPΤݡF
    • Apache O@ӦAݪnADn̾ NCSA HTTPd AoiӨӡAۥѳnF
    • Mozilla O@Ӧۥѳn骺}opeA䤤 firefox sOS\@~C
    • bgۤvƮɡAɶqϥ W3C ҵoGAǡAo˦bҦsW~^QܥXAQnˤlC

    pADϥ20.1.2 WWW APsҴѪ귽]w (URL)

    {bڭ̪D WWW AIOѤ@ǸơAoǸƥݭnOΤݪsiH䴩ܤ~C oǸƬO[H̔x[ASMjNOɮoCpӡAڭ̥ݭnbAݥNɮ׼gnA åBmbYӯSؿUAoӥؿNOڭ̾ӺFI @ӻAoӥؿܥiOb /var/www/html/ Ϊ̬O /srv/www/Cڭ̪ CentOS w]b /var/www/html C

    spooӥؿƩOHAݭnbsy}CzKJһݭn}~C oӺ}NR WWW AYɮɦWNOFCLA{s\bܦhALuiHsW WWW ARiHsW FTP qTwCҥHAonb}CKJT}AoӺ}]AoˡG

    • <w>://<DE}ΥDEW>[:port]/<ؿ귽>


    • }CNq

    WYNOڭ̱``o쪺 URL (Uniform Resource Locator) TIH׽u@qA iHo˳QG

    • wG

      s`䴩w http, https, ftp, telnet ΆΡAR news, gopher ΡC oӨwbisyЧAQΦ@ws^AݡzNC|ҨӻApGAUFG http://ftp.ksu.edu.tw osns Xsj http (Y port 80) NCpGO ftp://ftp.ksu.edu.tw hNs ftp (port 21) TI ]ϥΪwPAҥHSM^RƤ]ۦPCLA U@AfŰʦbDW𸹡AҦpN http Űʦb port 81 ɡAANono˼gG http://hostname:81/ C

    • DE}ΥDEWG

      NOAbںҦb IP mCpGODEW٪ܡASMonzLWٶRoI @ӻAMϥ IP N^[] WWW ALijAROӽФ@ӦnOSXkDEW٤nI

    • ؿ귽GG

      O쭺ؿܡHbؿU۹mNOoӥؿ귽TC |ҨӻAm www ƩmbڥDE /var/www/html/ SAҥHG

      • http://www.okfdzs1903.com --> /var/www/html/
      • http://www.okfdzs1903.com/linux_basic/index.php --> /var/www/html/linux_basic/index.php

      t~Aq`ؿU|ӯSɮצW١AҦp index.html index.??? ΡC|ҨӻApGA^UG http://www.okfdzs1903.com |o{P http://www.okfdzs1903.com/index.php O@˪I oO] WWW A|DʪHMؿUyzTI

    ҥHTAڭ̪A|ѩsǨӪnDwPӵ@˪^RơCAA}CNqFܡH


    • WWW server/client ƶljK覡

    pGsOH http://hostname AӦVAnƮɡAsPAݬOpǻƪOH 򥻤WoXRkG

    • GET
      NOs^V WWW AnD}CW귽Ao]O̱`C~Aϥ GET 覡iH^b}CKJӋC|ҨӻAmQAϦ@gݪzA L}OGyhttp://phorum.vbird.org/viewtopic.php?t=96zAo{ ?t=96 FܡH t NOӋA 96 NOoӋeCpGANݸ᭱ƮɡA@@|X{GH o򻡡AAiH GET BzFaH

    • POST
      o]OΤݦVAݴXnDAuOoӭnḒthƴNOFC |ҨӻAQAϸ̭O``dﶵܡApGAܯdܤO|bs_X@ӮخAJƶܡI SUǰeAǮخؤƴN|Qs]_Ӷǰe WWW AFC POST P GET ۦPA GET iHb}CoΤݩҭnDӋAL POST NOϥκ}C\FC

    • HEAD
      Aݦ^R Client ݪ@ǸYӤwF

    • OPTIONS
      Aݦ^R Client ݪ@Ǥ\\PkF

    • DELETE
      RYǸ귽|ʡC

    `O GET oӶTIpGjqƥѥΤݤWǨ WWW AݮɡA~|ϥΨ POST oӶءC AROoݭn`N@Uo|ʡA]򪺵nɤReOϥγoRʧ@ӤRI


    pADϥ20.1.3 WWW AG tBxBƮwP{ (LAMP)

    Hثe@ɨӻAv@ WWW AnRMO Apache P IIS oӪNA Apache OۥѳnAiHb@~tWwUAܩ IIS hO Windows aڶ}oXӪA ȯb Windows @~tWwUPCѩ@~tx@ˡAҥHWwUnSM]ۦPC UNڭ̨ӃԤ@ԥثe@ǯSaI


    • ȴѨϥΪsxVRA

    oRjhOѡyxVRAzAγ\Ѥ@ǰʵeϥܡA򥻤WNȤTI ]x¬OѦAxVѸƵȤݡAServer ݭnP Client ݦʡAҥHAiHMWhsA OLkiiƪWdzIثeDnKO[DEjhOoRCҥHAAun̷ HTML ykgnAAåBWǨMŶWAAƴNiHjasFI


    • ѨϥΪ̤ʤʺA

    oRiHAPϥΪ̤ʡA`ҦpQAA»PdA]A@Ljo]OݩoC oݭn޳N{פ@A]LO]ѡy{yzӹFPϥΪ̤ʪ欰A `Ҧp PHP {yAtX MySQL ƮwtӶiƪŪBgCӤʥiHϥΤUϨӻG

    ʺA{yPƮw
    20.1-2BʺA{yPƮw

    oNOҿתAݤu@Ȥ (Server Side Include, SSI)A]AAnDƬOAOzLAݦP@{btdNŪXμgJƮwA BzܫNGǵΤݪ@R覡AܰʪOƮwơA{èSܪCo{]A PHP, ASP, Perl...ܦhTI

    t~@RʦʺADnObΤݹFI|ҨӻAڭ̥iHzLQΩҿת Java scripts oRykA Ni檺{X (java script) ǰeΤݡAΤݪspG java script \A M{NiHbΤݪqWB@FCѩ{ObΤݹqWA ]pGAݩһs@{OcNAΤݪqNi|D}aC o]OԣܦhswgN@ǦMI java script }]C

    t~@RibΤݰ檺NO flash ʵe榡AboRʵe榡RiHi{]pA ]Τݥun֦iH flash ʵenANiHQγoӳnӹF줬ʦ͡C odzOʺAҴѪ\I

    qWAiHDʺAOثe]A^O~ӦpPBK@_XӪӤHo (blog) NOܸg媺ʺA@Cӥ 20.1-2 ڭ̤]Dno˪ʺAAݭnG

    • 䴩@~tGһݭnn鳣^wU[F
    • iB@ WWW AGҦp Apache P IIS WWW AxnF
    • {yG]A perl, PHP, JSP, CGI, ASP ΆγOTI
    • xsƮwtG]A MySQL, MSSQL, PostgreSQL HΥҰ (Oracle) ΆΡC


    • LAMP x

    bӥx]pWAثe`jtA@ӬO Linux @~tWAft Apache + MySQL + PHP ΦӹFAoӨtQ٬ LAMPCt@ӫhOLn IIS + MSSQL + ASP (.NET) ACbਣ׻Pv譱ARMROH LAMP DaIb LAMP ̭F Linux ~ALTӤpFNڭ̨ӽͽͥG

    • Apache (http://www.apache.org)

      1995 ~HeNܦh WWW AnA䤤H HTTPd v@C HTTPd gLh䔁׭qA~b 1995 ~oG Apache (A patch server) TIoFNODn WWW AxA᭱ͨ쪺 PHP nboNW~B@I

    • MySQL (http://www.mysql.org/)

      DžɮŪOꐷЪApGAunŪMɮS@pAtRO|NɮŪXӡA YShHPŪP@ɮ׮ɡAN|yįPtWDAҥH~|ƮwtXC ƮwO@RS榡ɮסAoRɮץݭnzLS (Ʈwn) ӶiŪgCѩoӯSwgwƪdߡBgJL̨ΤƳ]pA ]ܾAXhHPɼgJPdߪu@C

      wƮwykҿת SQL AǻykAھڳoR˯ykoiXӪƮwAN٬ SQL ƮwC WۥѳnƮwt MySQL PostgreSQL A䤤 MySQL ϥβvS@@ǡC MysQL iHzL{yӶiŪgu@A]ܾAXҦpQAϡBA†Ϊ]pA Ʀܫܦhη~nƤ]OzL MySQL oӸƮwnӦsOI

    • PHP (http://www.php.net/)

      өx誺kӻAPHP O@ӤuALiHQΨӫإ߰ʺAAPHP {XiH^b HTML SOJA N^Abs HTML @˪̔xCҥHA PHP O@Ry{yzAoR{yiH^bSsgA ݭngLsYii{Cѩ㦳GۥѳnBwxBeߤΰį@uIA ثeO]@ӳ]pNNIAiHbWܦh}yӰѦҪC

    Tips:
    WApG| Linux P[AAۤvvORO^AiHܡAh@ MySQL SQL ykAH PHP, JSP wx{yAAӬOܦDUI
    mϥ

    pADϥ20.1.4 httpsG [K (SSL) βĤT褽x

    } HTTP oӶljKwSAAݭnDOGyoӶljKwljKƬOHXǰezA ҥHAƫʥ]unQoѨܡAMƴNΩOOHTIQ@QA ALWudgܡHWudunKJAHΥddP}IAN^iFC pGAƦb Internet W]ɬOXpUAunRIAHΥdNHɥi|QsΡH

    MjhӋ Internet W WWW ҴѪƬOiHHNsALpPW쪺A @ǪyƥH}AӤHnEKSMNoHNǰeTI oӮɭԴNݭnΨ https://hostname oRsu覡TIoR覡OzL SSL [KEI


    • Secure Socket Layer (SSL)

    ROoڭ̦bĤQ@ت SSH ASLLsuEaH NOQΫD٪ key pair (Public + Private kye) œ_AMzL_[KljKA ljK؊ADEAHp_ӶKAp@ӸƦb Internet W]NH[K覡A QSMAoǸƦ۵MNwTISSL NOQΦb WWW ljKW[K覡@TI

    SsݻP WWW AݦPɤ䴩 SSL ljKwɡAbsu픬qsPAN|ͨ⭫n_I ͪ_N^QsӶǰeP^[KLnTInFo˪EA A WWW AݭnŰ https oӭnljKwAshݭnb}CKJ https:// }Y}A̤~^i淾qPsuCn`NOAbYǫ܂HsWO䴩 SSL A ҥHbǂHsWNLkF https suTI


    • Certificate Authorities (CA)

    Q@Q SSL oEDHLDNOGy Public key OAͥBHozIoODH] public key iHoA YQoåBs@@ӫAȦ檺AåBFAKJbKAnRFI]ADMOBFλs@A H https NOwAp@ӡAYϧAƦ[KAGAbARO^oAKJbK[I oӮɭԴNݭnĤT褽xDTI

    ҿת CA NO@Ӥ{xAAiHۦ沣ͤ@_Bs@XnҸƨæV CA xU (UANnD...oFOnQNI)ASΤݪsbsɡAMs|DʪV CA xT{MҬO_XkULApGOܡAMsu~|إߡApGOOHsN|oXĵiTA iϥΪRקKإ߳su[CҥHAp@ WWW Ax쪺IѡAϥΪ̦bإ߳suɤ]OI

    h} SSL H CA AiHѦҤ@UG


    pADϥ20.1.5 Τݱ`s

    ̫eͨ WWW AO Server/Client [cAӥΤݨϥΪnNOs[I ثeWۥѳnsDnfA]A Mozilla |޲z firefox (W) H Google ۦX chromeCܩ󥫦v@R windows IEC

    ѩsiHsںWAҥHs]iQ@I 䤤ѩ IE ^O Windows ֤SAҥHpG IE |}ɡAtl`OܤjI ]LApAаOoyȥnHɧs̷ssz~CijAiHϥ firefox chrome oǤpns[I

    Fsn餧~ARXӥiHbrUisPU{AOOG

    oXӫOڭ̤wgbĤ͹LFAЦۦeѦҳI


    jADϥ20.2 WWW (LAMP) A򥻳]w

    qeSAڭ̪Db Linux WnFAݭn Apache oMAnoIL Apache ȯണѳ̰򥻪RAƦӤwAQnFʺAܡA̦nROݭn PHP P MySQL 䴩~nCҥHUڭ̱N|H LAMP @wUP]wA[oaI ^_^


    pADϥ20.2.1 LAMP һݳnPc

    JMڭ̤wgO Linux @~tAӥBϥΪO٧ۮe Red Hat Enterprise Linux CentOS A SMunQ CentOS Ѫ Apache, PHP, MySQL YiIijAۦQ tarball wUA LAMP AC]ۦwUꐷСAӥB]otw]nTwC DASݨD (ҦpAY Apache ~{ݭn@AΪ̬O PHP, MysQL SݨD)A _hШϥ yum Ӷin骺wUYiC

    ڭ̪ LAMP ݭnǪFOHAݭnDOAPHP Ob Apache U檺@ӼœA ӧڭ̭nκ PHP { MySQL ɡAA PHP Non䴩 MySQL œ~IҥHAܤֻݭnUXӳnG

    • httpd ( Apache D{)
    • mysql (MySQL Ȥݵ{)
    • mysql-server (MySQL A{)
    • php (PHP D{t apache ϥΪœ)
    • php-devel (PHP oiuAoӻP PHP ~[tn馳})
    • php-mysql (ѵ PHP {Ū MySQL Ʈwœ)

    n`NA Apache ثeXRDnA]A 2.0.x, 2.2.x H 2.3.x ΆΡAܩ CentOS 6.x hO Apache 2.2.x oӪTCpGASwUܡAЪ^ϥ yum Ϊ̬O쥻ШӦwUG

    # wUn LAMP nG php-devel iH
    [root@www ~]# yum install httpd mysql mysql-server php php-mysql
    

    A@U Apache 2.2.x oӪ}cAoˤ~^DpBzڭ̪Ɣ[I

    • /etc/httpd/conf/httpd.conf (Dn]w)
      httpd ̥Dn]wɡA Apache ]LNOoӳ]wTI̭uO]s][ILܦhL distribution NoɮשӋӤpɮפO޲zPӋCODn]wROHoɦWDI AunoɦWNDp]wTI

    • /etc/httpd/conf.d/*.conf (ܦhB~ӋɡAɦWO .conf)
      pGAQnקl]w httpd.conf ܡAiHNAۤvB~ӋɿWߥXӡA ҦpAQnۤvB~]wȡAiHNLgJ /etc/httpd/conf.d/vbird.conf (`NAɦW@wO .conf ~) ӎŰ Apache ɡAoɮ״N|QŪJDn]wSFIonBHnBNOSAtɯŪɭԡA AXGݭnʭ쥻]wɡAunNAۤvB~Ӌɽƻs쥿TaIYiI@KTI

    • /usr/lib64/httpd/modules/, /etc/httpd/modules/
      Apache 䴩ܦh~œAҦp php H ssl O apache ~@RI ҦAQnϥΪœɮ׹w]OmboӥؿSI

    • /var/www/html/
      oNOڭ CentOS w] apache yzҦbؿTISAKJyhttp://localhostzɩܪơA NOboӥؿS (w] index.html)C

    • /var/www/error/
      pG]A]wh~AΪ̬OsݭnDƎh~ɡAbsWX{h~TNHoӥؿw]TDI

    • /var/www/icons/
      oӥؿ Apache w]@ǤpϥܡAAiHHNϥΔ[ISAKJyhttp://localhost/icons/z ɩܪƩҦbC

    • /var/www/cgi-bin/
      w]@ǥi檺 CGI ({) {mؿFSAKJyhttp://localhost/cgi-bin/z ɩܪƩҦbC

    • /var/log/httpd/
      w] Apache nɳbo̡AyqjӻAoӥؿnܤpߡA ]HmyqӻA@ӬPnɸƥiHj 700MBytes 1GBytes kAҥHAȥnק@UA logrotate nɳQYA_h...

    • /usr/sbin/apachectl
      oӴNO Apache DnɡAoӰɨO shell script ӤwA LiHDʪtW@dz]wȡAnAŰ Apache ɧ̔xI

    • /usr/sbin/httpd
      IoӤ~ODn Apache GiTI

    • /usr/bin/htpasswd (Apache KXO@)
      bYǺSAQnnJɧAݭnKJbPKXaI Apache NѤ@ӳ̰򥻪KXO@覡A MKXʹNOzLoӫOӹFI}]w覡ڭ̷|b WWW i픳]wSC

    ܩ MySQL 譱AAݭnDXӭnؿPɮצG

    • /etc/my.cnf
      oӬO MySQL ]wɡA]AAQni MySQL Ʈw̨ΤơAΪ̬Ow MySQL i@B~ӋwA iHboɮ׸̭FI

    • /var/lib/mysql/
      oӥؿhO MySQL ƮwɮשmҦbBTISAŰʥ MySQL AȮɡA аȥOobQɡAoӥؿ]n㪺QUӤ~[I

    t~Ab PHP 譱OAARM]nDXɮ׳G

    • /etc/httpd/conf.d/php.conf
      AnnʱNMœgJ httpd.conf SHݭnA]tDʱN PHP ]wӋgJoɮפFI ӳoɮ׷|b Apache sŰʮɳQŪJAҥH OK TI

    • /etc/php.ini
      NO PHP Dn]wɡA]AA PHP णह\ϥΪ̤WɮסHणह\YǧCwʪAxΆΡA boӳ]wS]wTI

    • /usr/lib64/httpd/modules/libphp5.so
      PHP oӳn鴣ѵ Apache ϥΪœIo]Oڭ̯_b Apache W]p PHP {y̭nNNI ȥnsb~I

    • /etc/php.d/mysql.ini, /usr/lib64/php/modules/mysql.so
      A PHP O_iH䴩 MySQL OHNݳoӪFTIoөNNO php-mysql n鴣ѪOI

    • /usr/bin/phpize, /usr/include/php/
      pGAӷQnwU PHP [tHstץ[֪ܡAoɮ׻PؿNonsbA _h[tniLks\IoӸƤ]O php-devel nҴѪTI

    򥻤Wڭ̩һݭnXӳnLcNOoTIW쪺O Red Hat t (RHEL, CentOS, FC) һݪơA pGO SuSE ΨLơAШ̷ӧA distribution ޲zn骺O (rpm dpkg) hdߤ@UA RMN^DUӭnƩmbTIoǸƫܭnAAݭnmaIIy~I


    pADϥ20.2.2 Apache 򥻳]w

    b}l]w Apache eAAnDѩDEWٹ WWW ONqAҥHMQ IP ][] WWW AA LijAROӽФ@ӦXkDEWnC pGOȮɴΪDEҥHSDEWٮɡAܤֽTwΥDEW٬ localhost BbA /etc/hosts ݭn@G

    [root@www ~]# vim /etc/hosts
    127.0.0.1   localhost.localdomain localhost
    

    o˦bŰʧA Apache ɤ~|oͧ䤣짹DEW (FQDN) h~TC~A Apache uOӦAxӤwAARݭnA HTML Hά}]pykA p~IACQn]pBͨӻARγnγ\OܦnJA LQn㪺A]pޥAROs@U䪺 HTML CSS SC

    pGAu@ǰykáAåB]Qn}o@ǩҿתyL^ŶzܡAiHyX@U http://www.w3c.org ҦC|AǻykAΪ̬OF|L^ŶӽгWd (http://www.webguide.nat.gov.tw) ۫H|ҦìTI

    nӽͤ@ͦp]w Apache o httpd.conf ]wɤFIAjաAC distribution oɮפeܬۦPAҥHAݭnۦX}]wɤ~Io httpd.conf ]wOHL򥻳]w榡Oo˪G

    <]w>
        ]wؤ}Ӌ
        ...........
    </]w>
    

    |ҨӻApGAQnwڭ̪ /var/www/html/ oӥؿѤ@B~\AG

    <Directory "/var/www/html">
        Options Indexes
        ...........
    </Directory>
    

    XGOo˪]w覡ISOdNOApGAB~]wɡAHKb httpd.conf YagJI_hpGngb <Directory>...</Directory> ̭AIII N|o͎h~TIݭnee᪺@IΪ̬Obɮת̫᭱[J]InTAU̥ӃԤ@ Apache A]waI

    Tips:
    Wb Apache ѫܦhNơAuO܌NTI mbUȬO@ǺDΪ]wتNqӤwCêܡAаȥned\G
    Apache 2.2 ֤ߤGhttp://httpd.apache.org/docs/2.2/mod/core.html
    mϥ

    • wA쪺]w

    Apache wA쪺]wؤ譱A]A^RΤݪAn骩BDEW١BA]wɳhؿΡC U̴Nӽͤ@͡G

    [root@www ~]# vim /etc/httpd/conf/httpd.conf
    ServerTokens OS
    # oӶئbȧiΤݧڭ̦AP@~tӤwAݭnʥLC
    # pGbGAtTQhݪΤdߨAhiHNoӶصYi(ij)
    
    ServerRoot "/etc/httpd"
    # A]w̳hؿAI chroot RP\C]A logs, modules
    # ΆΪƳRMnm즹ؿU (Yŧiʎ|)
    
    PidFile run/httpd.pid
    # m PID ɮסAiK Apache n骺޲zTIu۹|aI
    # Ҽ{ ServerRoot ]wȡAҥHɮצb /etc/httpd/run/httpd.pid I
    
    Timeout 60
    # A^ζǰeASsuΫݶWL 60 hMsuN_C
    # @ӻAӋȦb 300 kYiAݭnקoӭlTC
    
    KeepAlive On    <==̦nNw] Off אּ On TI
    # O_\ʪsuAY@ TCP suiH㦳hɮ׸ƶǰenDC
    # |ҨӻApGAtܦhɡAo@suN|NҦưeA
    # ӤCӹɳݭni@ TCP suCw] Off Чאּ On ΡC
    
    MaxKeepAliveRequests 500  <==iHN쥻 100 אּ 500 Χ@
    # PWӳ]w KeepAlive }AS KeepAlive ]w On ɡAhoӋȥiMw
    # Msu^ljK̤jljKӋqCFWiįhiHj@II0 NC
    
    KeepAliveTimeout 15
    # b\ KeepAlive UAhMsub̫@ljKΫݩ𪺬ӋC
    # SWLWzӋhMsuN_C]w 15 thTIpG]w@ (Ϋݮɶ)A
    # bLtWN|h Apache {Ǧθ귽Ai঳į譱xZC
    
    <IfModule prefork.c>   <==U perfork, worker PO޲z}I
    StartServers       8   <==Ű httpd ɡAX PID ӳBzAȪN
    MinSpareServers    5   <==̤pwQϥΪ PID Ӌq
    MaxSpareServers   20   <==̤jwQϥΪ PID Ӌq
    ServerLimit      256   <==A
    MaxClients       256   <==̦hiHe\h֭ӥΤݦPɳsu httpd NI
    MaxRequestsPerChild  4000
    </IfModule>
    <IfModule worker.c>
    StartServers         4
    MaxClients         300
    MinSpareThreads     25
    MaxSpareThreads     75
    ThreadsPerChild     25
    MaxRequestsPerChild  0
    </IfModule>
    

    W prefork worker OӻPAsu귽}]wءCw]ع@pӻwg^ΤFA LpGAyqjɡAγ\iH׭q@ṶӋȩOIoӼœOΦbѨϥΪ̳su귽 (process)A]wӋqVjNt|Űʤh{ǨӴ Apache AȡARt״N֡C ̔xAoӼœ\G

    • wœ\ӻG

      worker œΪOpAyqjӻAO@ӤnܡCprefork MθjOALt׻P worker tjAåB prefork Oϥγ]puqAiHbܦhLk debug xWiۧڰhAҥHAw]œNO prefork o@өOI

    • N]we譱G(H Prefork ҡA worker NqۦP)

      • StartServersGNŰ Apache ɴNŰʪ process ӋqAҥH apache |Ψ줣@{ǡI
      • MinSpareServers, MaxSpareServersGN̤jP̤pQε{ӋqC
      • MaxClientsG̤jPɳsuӋqA]NO process |WL@ӋqC{b] 10 ӤHsWӡA[We MinSpareServer=5, MaxSpareServers=20Ah apache ɪ{ӋR 15-30 ӤNCӳoӳ̜{ӋiWL 256 (̤Wz]w)I
      • MaxRequestsPerChildGCӵ{ǯ^Ѫ̤jljKӋnDC |ҨӻApGӨϥΪ̳sWA(@ process)AonDӋʭӺASLnDӋqWL@ӋȡA hM{Ƿ|QAt~@ӷs{ǡCoӳ]wiHĪިC process btWysɶzC ]ھ[ԎұoAs{ǪįTI

    bW]wAêO MaxClients oӵ{ǼœӋȡApPWAo MaxClients ]wȥiHyPɳsW WWW A`sunDzӋqAYQ@YɽuWHӋTC LAn`NOAMaxClients ӋqOV@VnA]L|O (P process })AҥHpGA]w@fPWXO^e\dAįϦӷ|C (]t|ϥγt׸C swap [)A~A MaxClients ]b Apache sɴNw̤jȤFAҥHA]LkWXt̤jȡA D...Ass Apache TI

    DAyqSOjA_hw]Ȥwg^AϥΪFCӦpGAO餣^jܡA MaxClients Ϧӭnդp@IAҦp 150 A_hįणΡCAapache 쩳OϥΨӼœ[Hprefork RO worker HW CentOS NoӼœO줣PSAOOG

    • /usr/sbin/httpdGϥ prefork œF
    • /usr/sbin/httpd.workerGϥ worker œC

    pMwAϥΪO@{HAiHhd\@U /etc/sysconfig/httpd A N^Dtw] prefork œAAiHzLק /etc/sysconfig/httpd Өϥ worker œC pGAܦn_ߡAiHOێŰʳoRœ[I^UӡA~@@LA]wӋaI

    Listen 80
    # Po}Aw]}bҦ[I]iקfAp 8080
    
    LoadModule auth_basic_module modules/mod_auth_basic.so
    ....(Uٲ)....
    # Jœ]wءCApache ѫܦhΪœ (NO~) ڭ̨ϥΤFI
    
    Include conf.d/*.conf
    # ]o@AҥHm /etc/httpd/conf.d/*.conf ]w|QŪJI
    
    User apache
    Group apache
    # e쪺 prework, worker μœҎŰʪ process ֦̻Psœ]wC
    # oӳ]wܭnA]ӧAѪɮׯणQsPoӨ}[I
    
    ServerAdmin vbird@www.centos.vbird  <==令Aۤv email a
    # t޲z emailASX{DɡAh~T|ܪpHc(h~^N)C
    
    ServerName www.centos.vbird    <==ۦ]wnۤvDEWٸΡI
    # ]wDEW١AoӭȦpGSwܡAw]|H hostname KX̾ڡC
    # dUOoAAJoӥDEW٭n䪺 IP I(DNS  /etc/hosts)
    
    UseCanonicalName Off
    # O_ϥΊAǥDEW١HpGADEhӥDEW١AYoӳ]w OnA
    #  Apache u^WY servername wDEWٳsuӤwCШϥ OffC
    

    bYǯSA줤AɭԧA|QnŰʦhӤP ApacheAΪ̬O port 80 wgQϥαFAfP Apache LkŰʦbw]fCAiHzL Listen oӳ]wȨӭקfIo]Oӫܭn]wȡC ~AA]iHNۤvB~]ww /etc/httpd/conf.d/*.conf AרO[DEܱ`ϥγo˪]wAbEɷ|ܤKI


    • w襤 big5 ytsX]wӋק

    ثeںljKƽsXhOHUX (UTF-8) DALbxWROShϥΪO Big5 c餤sX[IpGA Apache w]OH UTF-8 sXӶljKơAA WWW ƫoO big5 A ΤݱN|ݨyýXzIMiHzLվssXƥTܡAL`O\oܰQC ɡAARMiHվ@UUӋI

    [root@www ~]# vim /etc/httpd/conf/httpd.conf
    # 쩳Uo@ARMOb 747 楪k
    # AddDefaultCharset UTF-8  <==бNoI
    

    oӳ]wȪNqOAAljKyjϥ UTF-8 sXzTΤsA]AegA ϥbΤs|w]ϥθU}ܪNCpGAϥΪODUXytsXA ɴN|bsX{ýXFID`QҥHoSMݭnC An`NOApGAwgbΤݤWsL\hAAקLoӳ]wȫAMnNs֨ (cache) M~I_hۦPi|ݨýXI̤ͭwg^NLܦhFA oO Apache DAӬOΤs֨ҲͪTIOoBzBzI

    ytsXwgw]ȡAګ򪾹DڪytbΤݷ|ܪO@ӡHb̭ӴNŧiFG

    <html>
    <head>
    	<meta http-equiv="Content-Type" content="text/html; charset=big5" >
    	....(Lٲ)....
    

    ARMn׭qOWzSrBAӤOzL Apache ѹw]yt~I


    • Υؿ}v]w (DocumentRoot P Directory)

    ڭ̤OL CentOS WWW w]mb /var/www/html oӥؿܡHOH] DocumentRoot oӳ]wȪ}YTI~Aѩ Apache \ Internet ڭ̪ƶisA ҥHASMnwiQsؿiv}]wANO <Directory> oӳ]wȪnSIڭ̨Ӭݬݹw]D]waI

    [root@www ~]# vim /etc/httpd/conf/httpd.conf
    DocumentRoot "/var/www/html"  <==iH令AmؿI
    # oӳ]wȳWdF WWW ADҩmyؿzAM]wȤeiHܧA
    # OnSOdNoӳ]wؿvH SELinux }WhP(type)I
    
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    # oӳ]wȬOw WWW Ayw]zӨӪA]wy/z]wI
    # ijOdWzw] (WYƤwgOY檺)A}ӋeỡC
    
    <Directory "/var/www/html">         <==wSwؿIUӋܭnI
        Options Indexes FollowSymLinks  <==ij Indexes SI
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>
    

    oӦahOw /var/www/html oӥؿӳ]wvTINO̭ҦbؿvC DnXӳ]wتNqOo˪ (odz]wȳܭnInJNݳI)G

    • Options (ؿӋ)G

      ]wȪܦboӥؿ^ Apache i檺ʧ@AYOw apache {Ǫv]wTIDnӋȦG

      • IndexesGpGbؿU䤣yɮ (w] index.html) zɡA NܾӥؿUɮצW١AܩyɮɦWzhP DirectoryIndex ]wȦ}C

      • FollowSymLinksGoO Follow Symbolic Links YgA rNqOsɥiHͮĪNCڭ̪Dؿb /var/www/htmlAJMO WWW ڥؿAzAWN^Q chroot @I @ӻQ chroot {NLkm}ؿA]NOw]pUAAb /var/www/html UsɥunsDؿLaAhMsɹw]OĪC ϥΦ]wYisɦĪm}ؿC

      • ExecCGIGؿ㦳 CGI {vAD`nI|ҨӻAe] OpenWebMail ϥΤFܦh perl {AAn OpenWebMail iHANonbM{Ҧbؿ֦ ExecCGI v~IЪ`NAnҦؿiϥ ExecCGI I

      • IncludesG@ Server-Side Include {iHB@CijiH[WhI

      • MultiViewsGoN঳I^Ohy䴩APyt (LanguagePriority) }C̱`bh~T^NeAbP@DEAiH̾ڥΤݪytӵPyܩOI w]bh~^NTSsbAAiHˬd@U /var/www/error/ ؿUƳI

    • AllowOverride (\gӋ\)G

      ܬO_\B~]w .htaccess YǰӋgHڭ̥iHb httpd.conf ]wnҦvALp@ӭYϥΪ̦ۤvӤHQnקvɱN|޲zyxZC] Apache w]iHϥΪ̥HؿU .htaccess ɮפg <Directory> Yǥ\ӋC oӶثhObWw .htaccess iHgvǡC`G

      • ALLGviQgF
      • AuthConfigGȦ{ (bKX) igF
      • IndexesGȤ\ Indexes 譱gF
      • LimitsG\ϥΪ̧Q Allow, Deny P Order ޲zisvF
      • NoneGigAY .htaccess ɮץġI

      oڭ̦bi픳]wɷ|A쪺I

    • Order, Allow, Deny (_nJsv)G

      MwؿO_iQ apache PID sv]wTI_QsDnRPw覡G

      • deny,allowGH deny uBzASgJWhhw] allow C
      • allow,denyGH allow uBzASgJWhhw] deny C

      ҥHbw]줤A]O allow,deny ҥHw] deny (is)ALbU@榳 Allow from allAallow uBzA] (all) ΤݬҥisTIoڭ̷|b 20.3.4 i픦w]wSAκwC

    FoǸƤ~AƬ}@RUXөNNG

    [root@www ~]# vim /etc/httpd/conf/httpd.conf
    DirectoryIndex index.html index.html.var  <==yɮתɦWz]wI
    

    pGΤݦb}CuKJؿAҦp http://localhost/ ɡA Apache NXɮרܩOHNOXɮ׹I oɮתɦWb Apache Sw]OH index.* }YA Windows hH default.* ɦW}YCpGAQn index.pl index.cgi ]iHOɦWAiH令G

    • DirectoryIndex index.html index.htm index.cgi index.pl ...

    pGWɦWqqsbܡAMHNӶǔ[I^b DirectoryIndex ᭱ɦWӋAVeVuŪC pGɦWqqsbOHNOSɡAMpŪHoNPͨ쪺 Options ̭ Indexes }I o˦SNӰӋ_ӡH

    [root@www ~]# vim /etc/httpd/conf/httpd.conf
    # Alias  }C  Linuxؿ
    Alias /icons/ "/var/www/icons/"  <==s@@ӥؿOW (S|)I
    <Directory "/var/www/icons">
        Options Indexes MultiViews
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>
    

    o Alias ܦêIOs@XsɪFTISAKJ http://localhost/icons ɡAA /var/www/html èS icons ӥؿALѩ Alias (OW) }YA|M}^s /var/www/icons/ UC o̭w]ܦh Apache ѪpϥܳIӦ]]wF@ӷsisؿAҥHA@AhF <Directory> ӳWwvFaI ^_^

    [root@www ~]# vim /etc/httpd/conf/httpd.conf
    # ScriptAlias  }C  Linuxؿ
    ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
    <Directory "/var/www/cgi-bin">
        AllowOverride None
        Options None
        Order allow,deny
        Allow from all
    </Directory>
    

    PW icons ALooOH ScriptAlias (i}OW) ]wȡI oӳ]wȥiHwMؿUy㦳 ExecCGI zOؿҦbIҥHAiHN Open webmail {Lm /var/www/cgi-bin ANB~]wLؿөmA CGI {I oˤjyN OK FTI^UӷǷQ@UݬRB~]wɻݭnBzOH


    pADϥ20.2.3 PHP w]Ӌק

    ڭ̫eyLL PHP O Apache S@ӼœAbͤF Apache httpd.conf Ayڭ̫S PHP oӼœ]w[HzOTIӬO]ثe Apache oN@ǭnœLXөm /etc/httpd/conf.d/*.conf ɮפFAҥHڭ̥nMؿU~AYǼœO_Q[J[IU@@aI

    [root@www ~]# cd /etc/httpd/conf.d
    [root@www conf.d]# ll *.conf
    -rw-r--r--. 1 root root 674 Jun 25 15:30 php.conf      <== PHP œ]w
    -rw-r--r--. 1 root root 299 May 21  2009 welcome.conf  <==ѹw]wT
    # pGAOӭmXӼœhwUAoӥؿUܤַ|oӸơA
    # @ӬOWd PHP ]wA@ӫhOWdypGsbɪwezoC
    

    ڭ̥DnӬݬ} PHP ]wɧaG

    [root@www conf.d]# vim /etc/httpd/conf.d/php.conf
    <IfModule prefork.c>  <==ھڤP PID ҦP PHP B@œ
      LoadModule php5_module modules/libphp5.so
    </IfModule>
    <IfModule worker.c>
      LoadModule php5_module modules/libphp5-zts.so
    </IfModule>
    AddHandler php5-script .php  <==ҥHɦW@wnO .php I
    AddType text/html .php       <==.php ɮ׬O¤r
    DirectoryIndex index.php     <==ɦWW[ index.php I
    #AddType application/x-httpd-php-source .phps <==SΪkI
    

    CentOS 6.x ϥΪO PHP 5.x AoӪ̾ڤP apache ϥΰOҦ (prefork worker) PœI~AFWd PHP ɮסA]hF̫TA]AW[ɦW .php ɮ׳Bz覡A .php wq¤rɡAHέɦWW[ index.php ΡC򥻤WAoɮקAݭn󪺭קAOd˧YiC


    • PHP w譱]w

    AnD PHP ]wɨOb /etc/php.ini AoɮפeYǦaiHi@ǤpקA ]YǦaAnSOdNAKoQΤݻ~ΧA PHP 귽CU@U PHP `Pw譱}]wG

    [root@www ~]# vim /etc/php.ini
    register_globals = Off
    # oӶؽнTw Off (w]NO Off)A]pG]w On ɡA
    # M{eXpAOܮepߴNQ@C
    
    log_errors = On
    ignore_repeated_errors = On  <==oӳ]wȽվ@U (]w] Off)
    ignore_repeated_source = On  <==oӳ]wȽվ@U
    # oTӳ]wإiHMwO_nN PHP {h~O_ӡA
    # ijNƪh~ƩA_hbܦLtWA
    # oǎh~ƱNiyAnɼɼWAfPįण (SE)
    
    display_errors = Off
    display_startup_errors = Off
    # SA{oͰDɡAO_nbsWYܬ}h~T (]A{X)
    # jPij]w Off CLpGO|} WWW AAFA debug
    # eAiHȮɪNL]w On Ap@ӧA{D|bsW
    # ^ܥXӡAAݭniJ /var/log/httpd/error_log nSd\C
    # {AOoN]wȧאּ Off InnI
    

    pGAQn Apache 󵹦ۤv WWW AܡAiHwU@U httpd-manual oӳnAAN|o{boӥؿSS|sWɮ (manual.conf)AӥBqAiHϥ http://localhost/manual ӵnJ Apache ϥΤUOIuKIêܥiHѦһPwUUodznG

    • httpd-manualG Apache ѦҤ󪺤@ӳnF
    • mrtgGQøϳn۰ʲͥDEyqϪnF
    • mod_perlGA WWW A䴩 perl g{(Ҧp webmail {)F
    • mod_pythonGA WWW A䴩 python g{C
    • mod_sslGA WWW iH䴩 https oR[KL᪺ljKҦC

    perl P python OP PHP NNAO@ǫܱ`Φb{yI ҦpW OpenWebMail (http://openwebmail.org/) NOQ perl gCnA WWW 䴩M{yA ANonwUoǪFTI(OҦn鳣wUIЦwUAݭnYiI)


    • PHP ѪWǮeq

    ڭ̥ӥi|ϥ PHP gnӴѥΤW/Uɮ׸ơA PHP Sɮ׮eqOH ׬OIeqOhjHw]O 2M kCAiHק復A]ڭ̲{bn 16MBytes ɡAڭ̥iHo˭׭qG

    [root@www ~]# vim /etc/php.ini
    post_max_size = 20M       <==jb 729 楪k
    file_uploads = On         <==@wnO On ~ (w])
    upload_max_filesize = 16M <==jb 878 楪k
    memory_limit = 128M       <==PHP iΰOeq]׭qI
    

    PɮפW/Ueq}NOoXӳ]wȡ㬰ԣ post_max_size n upload_max_filesize jOH ]ɮצi]OzL POST 覡ljKڭ̦AWYAɧAɮ״Non[J POST T ] POST TiRt䥦B~TAҥHSMnɮ׮eqj~IҥHb]poӳ]wɮɡA oӭȱonSO`NI


    pADϥ20.2.4 Ű WWW AȻP PHP œ

    OKIx̔ WWW A]wdwthFA^UӴNOnŰTIŰʪk̔x줣AζDž覡ӳBzG

    [root@www ~]# /etc/init.d/httpd start       <==ߨŰTI
    [root@www ~]# /etc/init.d/httpd configtest  <==]wɻyk
    [root@www ~]# chkconfig httpd on            <==}EŰ WWW TI
    

    t~A Apache ]ۦ洣Ѥ@ script iHڭ̨̔xϥΡANO apachectl o{TI o{ΪkP /etc/init.d/httpd XG@Ҥ@˳I

    [root@www ~]# /usr/sbin/apachectl start  <==ŰTI
    [root@www ~]# /usr/sbin/apachectl stop   <==} WWW TI
    

    @ijAiHyLO@U apachectl o{A]ܦh{Ҧ҄|ҡAӥBL]O Apache w]Ѫ@Ӻ޲zOInFAӬݬݦSŰʦ\H

    # ݬ port SŰʔ[I
    [root@www ~]# netstat -tulnp | grep 'httpd'
    Proto Recv-Q Send-Q Local Address  Foreign Address State  PID/Program name
    tcp        0      0 :::80          :::*            LISTEN 2493/httpd
    
    # AӬݬݵnɪTOFIoӽTij@@@I
    [root@www ~]# tail /var/log/httpd/error_log
    [notice] SELinux policy enabled; httpd running as context unconfined_u:system_r:httpd_t:s0
    [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
    [notice] Digest: generating secret for digest authentication ...
    [notice] Digest: done
    [notice] Apache/2.2.15 (Unix) DAV/2 PHP/5.3.2 configured -- resuming normal operations
    # Ĥ@biϥ SELinux(jդ@U)A̫@N`ŰʤFI
    

    oRMN\ŰʤF Apache oInORŰ SELinux }AoUڭRon`N`NOI ^UӴݬݯणݨOHݬ /var/www/html SơHxHSS}YA] CentOS Dڭ̳yF@ӴF (Apache welcome œ\)AҥHARObsWKJAoDE IP ݬݥG

    Ű Apache AҬݨ쪺w]
    20.2-1BŰ Apache AҬݨ쪺w]

    AiHbAWŰʹϧΤӬd\A]iHzLȤݹqӳsu (]DwgJAF)C mo̰]A runlevel 3 ¤rA]ϥΥ~ΤݹqsuA IP WApWϵebY 1 BCpGAObAEWŰʪsA^KJy http://localhost zYiCPɬݨebY 2 ҫBAANiHo{mOb /var/www/html/ UoIpGQnDS\X PHP œAA̦n /var/www/html ؿUhإߤ@̔xɮסG

    [root@www ~]# vim /var/www/html/phpinfo.php
    <?php  phpinfo ();  ?>
    

    nOAPHP ɮתɦW@wnO .php ~Iܩ󤺮eAӡy <?php ... ?> zOOJb HTML ɮפ PHP {ykAboӊAҤNO PHP {XC phpinfo(); NO PHP {Ѫ@Ө禡wAoӨ禡wiHܥXA WWW A}AȸTA ]ADn Apache TP PHP TΆΡCoɮ׫ظmܫA^UӧAiHQshs@UoɮסG

     Apache _X PHP œ
    20.2-2B Apache _X PHP œ

    `Nݺ}I]ڭ phpinfo.php OmbؿUA] URL SMNWzbY 1 SҼˤFC o phpinfo() ӋKXeREKAҥHܫбNoɮקRaIqWYeAiHD PHP œH Apache }nTIۤvJN@@aIp@ӡAA Apache P PHP N OK TI

    U@ѫH`h~DHζMDiHѦҡG

    • DGMbEWSDA N@wOqIнT{@UAIҦp Route table, D^pΆΡF
    • ]wɻykh~GoӰDܱ`o͡A]]wh~AfPLkNAȎŰʦ\C ɰFѦҿ݁WKXT~AA]iHzL /etc/init.d/httpd configtest ykAΪM׬OѦ /var/log/httpd/error_log ơAiHoɪMDC
    • vDGҦpAb httpd.conf W user ]w apache FAnQsɮשΥؿv apache SiŪvA۵MNLkHasuihTI
    • DMDGpGROSks^WӧA Linux Apache DEAСG
      1. Ԏ /var/log/httpd/error_log oɮקaILRMiHiDAܦhTI
      2. JNԎݤ@UAsWܪTAoˤ~^DDXb̡I
      3. t@ӥihOTIԎݤ@U iptables TI]iO SELinux DI

    pADϥ20.2.5 MySQL 򥻳]w

    b LAMP A̭ALinux, Apache, PHP wgBzܡA MySQL OHҥHA^UӴNOnBzoӸƮwnoC bŰ MySQL etèSDڭ̫إߥ󪺸ƮwCSA즸Ű MySQL At~|wƮwilƪإߔ[C ۫HܧAiHݬ /var/lib/mysql/ oӥؿA̭SƪTC


    • Ű MySQL (]w MySQL root KXPsW MysQL Τb)

    onŰ MySQL ~AŰʪkRO̔x[I

    [root@www ~]# /etc/init.d/mysqld start
    [root@www ~]# chkconfig mysqld on
    # pGO즸ŰʡA݁|ܤ@ǰTB /var/lib/mysql |إ߸ƮwC
    
    [root@www ~]# netstat -tulnp | grep 'mysql'
    Proto Recv-Q Send-Q Local Address  Foreign Address   State   PID/Program name
    tcp        0      0 0.0.0.0:3306   0.0.0.0:*         LISTEN  2726/mysqld
    
    # Ubݯ_Hʪ覡sW MySQL ƮwI
    [root@www ~]# mysql -u root
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 2
    Server version: 5.1.52 Source distribution
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    mysql> exit
    Bye
    

    MySQL w]ofb port 3306AqWݨӧڭ̪ MySQL GOŰʤFALlƪ MySQL Ʈw޲zèSKXAҥHܥiڭ̪ƮwO|QϥΪ̷d걼ҥHA̦n MySQL ޲zb]w@UKX~nC t~AW root Pڭ Linux b root OL}I] MySQL Ʈwn]OӦhHާ@AbMn餺Ӻ޲z̫nb]O root ӤwC

    pw MySQL oӳn餺 root oӺ޲z̳]wLKXOHAiHo˰G

    [root@www ~]# mysqladmin -u root password 'your.password'
    # qH MySQL  root bNݭnKXFIpUҥܡG
    
    [root@www ~]# mysql -u root -p
    Enter password:  <==AnbỏKJإߪKXI
    
    mysql> exit
    

    p@ MySQL Ʈw޲z譱|wTIn@kOOإߤPϥΪ̺޲zPƮwC |ҨӻApGAn vbirduser oӨϥΪ̤@ MySQL ƮwϥvA]AnLƮwW٬ vbirddbABKX vbirdpw ɡAAiHo˰G

    [root@www ~]# mysql -u root -p
    Enter password:  <==peҭzAAnKJKXI
    mysql> create database vbirddb;  <==`NCӫO᭱n[W (;)
    Query OK, 1 row affected (0.01 sec)
    
    mysql> grant all privileges on vbirddb.* to vbirduser@localhost 
    identified by 'vbirdpw' ;
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> show databases;
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | mysql              | <==ΨӰO MySQL bBDEέnTDnƮwI
    | test               | 
    | vbirddb            | <==ڭ̭إߪƮwb
    +--------------------+
    4 rows in set (0.00 sec)
    
    mysql> use mysql;
    mysql> select * from user where user = 'vbirduser';
    # WӫObdߨtS vbirduser oӱbAYX{@ͪFA
    # NOdߨMbFIo˴NظmSoI
    
    mysql> exit
    

    MAiHQΡy mysql -u vbirduser -p zoӫOӹnJ MySQL ݬݡAKKIND vbirduser oӨϥΪ̦b MySQL ̭֦@ӦW٬ vbirddb ƮwTILhΪkNoЧAۦѦ SQL }ykoIb媺QAdTI


    • įծ /etc/my.cnf

    ѩ MySQL oӸƮwtpGbܦhϥΪ̦PɳsuɡAi|yYǮį譱~VA ]ApGAƮwunjnjAijiH postgresql oMnAoMn骺ϥλP mysql GtjC LAڭROѤ@̔x覡ӳBzp MySQL įnFC}ƉmOѦҳo@g̔x廡G

    [root@www ~]# vim /etc/my.cnf
    [mysqld]
    default-storage-engine=innodb
    # }ؿƻPyt]wΆΡF
    default-character-set   = utf8   <==CӤHsXۦPAnHNڤ@
    port                    = 3306
    skip-locking
    # }O骺]wA`NAO骺̔xp覡G
    # key_buffer + (sort_buffer + read_buffer ) * max_connection
    # B`qi@ڪOqIҥHAکURMO OK 
    # 128 + (2+2)*150 = 728MB
    key_buffer              = 128M
    sort_buffer_size        = 2M
    read_buffer_size        = 2M
    join_buffer_size        = 2M
    max_connections         = 150
    max_connect_errors      = 10
    read_rnd_buffer_size    = 4M
    max_allowed_packet      = 4M
    table_cache             = 1024
    myisam_sort_buffer_size = 32M
    thread_cache            = 16
    query_cache_size        = 16M
    tmp_table_size          = 64M
    # ѳsuTw_uɶA쥻O 28800 (sec) A 8 pɡAڱNLאּ 20 I
    wait_timeout            = 1200
    thread_concurrency      = 8
    innodb_data_file_path = ibdata1:10M:autoextend
    innodb_buffer_pool_size = 128M
    innodb_additional_mem_pool_size = 32M
    innodb_thread_concurrency = 16
    
    datadir=/var/lib/mysql
    socket=/var/lib/mysql/mysql.sock
    user=mysql
    symbolic-links=0
    [mysqld_safe]
    log-error=/var/log/mysqld.log
    pid-file=/var/run/mysqld/mysqld.pid
    

    An`NOA]mDEW]O馳 2GB [IҥHO}Ƥ~|gܤjI Ш̷ӧAھ֦OqӳBzIRo[WA Apache OζqI ҥH...pGAyqܤjܡAbկWnܪ`N[I


    • MySQL root KXѰOBz

    pGApߧѰO MySQL KXHW@ǤuiHAhBz MySQL Ʈw^C pGAƮweäOܭnAR]Lҿת ( @_@)AiHN MySQL }A N /var/lib/mysql/* ӥؿƧRAMAsŰ MySQL A MySQL Ʈw|ءA A root SSKXTI

    LAoӤkȾAXAƮwänɭԡApGƮwܭn...dUnHKR[I


    pADϥ20.2.6 ]wP SELinux Wh

    ]wnF LAMP A}lnΤݨӳsu[IpOHnǰfH誺 port 3306 nnH o̽Ъ`NApGOp WWW AWAApache Os^E MySQLAèS}񵹥~Τӳs^ƮwI ]AФnN 3306 浹ںs^ADAuDAnLAŪA MySQL IJMpASMun} port 80 YiC

    ~ApGA Apache RQni@B~suu@A SELinux @̔xWh]oI_h|DTIL SELinux DnMA]iHѦҵnɨӭ׭qI nFAڭ̔xӽͽ͡G

    # 1. 樾 port 80 su
    [root@www ~]# vim /usr/local/virus/iptables/iptables.rule
    iptables -A INPUT -p TCP -i $EXTIF --dport  80  --sport 1024:65534 -j ACCEPT
    # NWo@檺YiI
    [root@www ~]# /usr/local/virus/iptables/iptables.rule
    [root@www ~]# iptables-save | grep 80
    -A PREROUTING -s 192.168.100.0/255.255.255.0 -i eth1 -p tcp -m tcp --dport 80 
       -j REDIRECT --to-ports 3128 <==o@Oi squid ͪARMn
    -A INPUT -i eth0 -p tcp -m tcp --sport 1024:65534 --dport 80 -j ACCEPT
    # ݨWoANON[iӤFAΤRMO^suoI
    
    # 2. M SELinux WhDG
    [root@www ~]# getsebool -a | grep httpd  <==|X{@ͳWhAêpUG
    [root@www ~]# setsebool -P httpd_can_network_connect=1
    # LWhAΫݫ򪺏ظ`Aӽ͡I
    
    DG
    AQnקﭺeABϥ root b /root UإߤF index.html FAoɮױNQʨ /var/www/html UA ЫإMɮסAåBmɮסAsݬݡC
    G
    iHzL̔x覡إߤ@ӵL}nɮסG
    [root@www ~]# echo "This is my Home page" > index.html
    [root@www ~]# mv index.html /var/www/html
    [root@www ~]# ll /var/www/html/index.html
    -rw-r--r--. 1 root root 21 2011-08-08 13:49 /var/www/html/index.html
    # vݰ_ӬO OK I
    
    {bШϥss@U http://localhost AN|o{LkŪIHˬd /var/log/httpd/error_log H /var/log/messages eG
    [root@www ~]# tail /var/log/httpd/error_log
    [error] [client 192.168.1.101] (13)Permission denied: access to /index.html denied
    [root@www ~]# tail /var/log/messages
    Aug  8 13:50:14 www setroubleshoot: SELinux is preventing /usr/sbin/httpd "getattr"
     access to /var/www/html/index.html. For complete SELinux messages. run sealert -l
     6c927892-2469-4fcc-8568-949da0b4cf8d
    
    ݨWeUaFaHNOLI@UAANo{pBzoI


    pADϥ20.2.7 }l]pΦwU[nAp phpBB3

    䪺 LAMP A[]ܤA򥻤WAANiH}l]pAQnoIsguܦhAЦۦMaI Lo̔x LAMP AAAnDOG

    • w]ؿb /var/www/html/AARMNҦ WWW ƳhMؿU~I
    • `NAv (rwx P SELinux)Iȥn Apache {ǨϥΪ̯^sI
    • ɶqNAɮɦW index.html index.php I
    • pGQnإߦbLaAARMnק DocumentRoot ӰӋ (httpd.conf)
    • nNnƩΪpƩm /var/www/html/ I
    • pGAݭnwU@ CGI {ܡAijANLwU /var/www/cgi-bin/ UA p@ӧAݭnB~]w httpd.conf YiQŰ CGI {F

    Foǰ򥻪ؤ~AAiHϥκںWHawgn PHP {[EI ĴpQAϳn phpBB3 oӪNA㪺[n PHPNuke HΈon lifetype ΆΡC oǬ[Eݭn PHP PƮw䴩AҥHAݭnNWz LAMP 㪺wUn~C pGAwۤvgܡAoǦΪ[nN^A@oImCXXӳsA@I

    LЪ`NAodznѩO}AҥHǩǨi|ڥHåΩζçA]i|@ bug |X{I]AAݭno̷sӪ~AӥB[]Ron[ԎO_sX{A Hɥhs̷s~IKowLa


    jADϥ20.3 Apache Ai픳]w

    WAWY򥻳]wwgܨ^B̬ͭ[] WWW AһݤFILARܦhiHaA ҦpӤHΤ᭺B[DEHλ{ҫO@ΆΡCUڭ̤Oӽͤ@oI


    pADϥ20.3.1 ŰʥΤ᪺ӤH (vOI)

    C@ WWW A@ӭAOpGCӭӤHΤ᳣QniHۤvުɡAMp]pHIApache NDڭ̷QFILs]wɤ``Ow]Noӥ\AҥHAݭnۦ׭qOI

    [root@www ~]# vim /etc/httpd/conf/httpd.conf
    # pU]wءAjb 366 楪kG
    <IfModule mod_userdir.c>
        UserDir disable
        #UserDir public_html
    </IfModule>
    # NL令pUpI
    <IfModule mod_userdir.c>
        #UserDir disable
        UserDir www
    </IfModule>
    
    # sŰʤ@UI
    [root@www ~]# /etc/init.d/httpd restart
    

    ouOӽdҡAApache w]ӤHOmbaؿU ~/public_html/ ؿUIpAtӱbs studentA w]ݩ student ӤHN|mb /home/student/public_html/ UCLAo public_html bܰQA ݰ_ӸSS}sʡA]m|Noӥؿאּ wwwAҥH student ӤHN|Ob /home/student/www/ ؿUAnOСC

    DG
    pөҦysWzϥΪ̹w]aؿU www ؿH
    G
    ]sWϥΪ̮ɩҰѦҪaؿb /etc/skel ؿAҥHAiH^ mkdir /etc/skel/www YiC YQnΤ᪽^֦@̔AR^ϥ echo "My homepage" > /etc/skel/www/index.html OI


    • ӤH URL HΥؿvBSELinux ]w

    {b]ڭ̭nwgsbt student oӱb㦳ӤHANonʥhظmһݭnؿPɮפ~C {bеnJ studentAåMbظmU}TG

    [student@www ~]$ mkdir www
    [student@www ~]$ chmod 755 www  <==w www ؿ}v
    [student@www ~]$ chmod 711 ~    <==nѤFaؿ]nI
    [student@www ~]$ cd www
    [student@www www]$ echo "Test your home" >> index.html
    

    ѩ CentOS w]ϥΪ̮aؿvO drwx------ AovNLk Apache {s[IҥHAܤ֭nAaؿv drwx--x--x ~Ioӫܭn[I 򥼨ӥunAbs}CoˉKJG

    • http://ADEW/~student/

    yzAWzN^ݨAӤHFCLAiOAڭ̪ SELinux èSӤHIҥHAɧA|o{sX{ yYou don't have permissionzTIԒݤ@UA /var/log/messagesA̭RM|Aiou@G

    [root@www ~]# setsebool -P httpd_enable_homedirs=1
    [root@www ~]# restorecon -Rv /home/
    # Ĥ@ӫObӤHWhAĤGӫObBzwI
    

    NiHݨAϥΪ̭ӤHoIϥΪ̦ۤvh]pLaI{bADӤ (~) b URL WNqFaH ^_^ILAhoӤ򔁴NܰQڥiiHNϥΪ̪ӤH]wG

    • http://ADEW/student/

    OiHTI̔xkOo˪G

    [root@www ~]# cd /var/www/html
    [root@www html]# ln -s /home/student/www student
    

    ѩڭ̭y Options z FollowSymLinks oӰӋ]AҥHiH^ϥγsɧYiC t~ڭ̤]iHϥ Apache ѪOW\ (Alias)AҦpo˰G

    [root@www ~]# vim /etc/httpd/conf/httpd.conf
    # ӤPHa]wȦzZa[Joӳ]wءG
    Alias /student/ "/home/student/www/"
    <Directory "/home/student/www">
            Options FollowSymLinks
            AllowOverride None
            Order allow,deny
            Allow from all
    </Directory>
    
    [root@www ~]# /etc/init.d/httpd restart
    

    LApGAϥγoӤkܱonSO`NAb httpd.conf Alias ᭱^ؿAݭn[WؿŸ (/) bBA PɡA}CnKJ http://IP/student/ IYO]n[W׽u~I_h|ܧ䤣M URL I


    pADϥ20.3.2 ŰʬYӥؿ CGI (perl) {v

    beXӤp`̭ڭ̦ͨApGAQn Apache iH perl {ɡA ANoݭnwU@B~œ~C䤤 mod_perl P mod_python oӳnijA̦nwU@UTIMڭ̤]Qn CGI {No /var/www/cgi-bin/ ؿUhCpGAQnbLؿU CGI {O_iHHSM[I


    • QηsؿU Options Ӌ]wG

    ]Qn CGI {ɦW .cgi .pl ABmؿb /var/www/html/cgi/ ɡAAiHo˰G

    [root@www ~]# yum install mod_python mod_perl
    [root@www ~]# vim /etc/httpd/conf/httpd.conf
    # 쩳Uo@Ajb 797 楪kTG
    #AddHandler cgi-script .cgi
    # NL令UҼˡAɦW .pl ɮפ]I
    AddHandler cgi-script .cgi .pl
    
    # M[JUoXӨMw}Yӥؿ CGI vC
    <Directory "/var/www/html/cgi">
        Options +ExecCGI
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>
    
    [root@www ~]# /etc/init.d/httpd restart
    

    ^UӥunA CGI {㦳 x vALNiHTI|ҨӻAAɮצb /var/www/html/cgi/helloworld.pl ܡAG

    [root@www ~]# mkdir /var/www/html/cgi
    [root@www ~]# vim /var/www/html/cgi/helloworld.pl
    #!/usr/bin/perl
    print "Content-type: text/html\r\n\r\n";
    print "Hello, World.";
    [root@www ~]# chmod a+x /var/www/html/cgi/helloworld.pl
    

    Mb}CKJGyhttp://DEW٩ IP/cgi/helloworld.plzYiMɮרñNGܦb݁WoI


    • ϥ ScriptAlias \G

    AiH^QɦWOWӳBzYiI̔xOCڭ̲{b]Ҧb /var/www/perl/ ؿUɮ׳iHO perl Ҽg{XAڭ̥iHo˰G

    [root@www ~]# vim /etc/httpd/conf/httpd.conf
    # P˪AnT{o@OsbI
    AddHandler cgi-script .cgi .pl
    
    # M[JUoXӨMw}Yӥؿ CGI vC
    ScriptAlias /perl/ "/var/www/perl/"
    
    [root@www ~]# /etc/init.d/httpd restart
    
    [root@www ~]# mkdir /var/www/perl
    [root@www ~]# cp -a /var/www/html/cgi/helloworld.pl /var/www/perl
    

    {bAЦb}CKJGyhttp://IP/perl/helloworld.plzAN^ݨ誺ƤFIoӤkTI]Mؿݭnb Apache U]iH\TIoӤkAiHHN@ӨӳBzYiIݭnӳiTI


    pADϥ20.3.3 䤣ɪܰTq

    pGA /var/www/html/cgi ؿUS󭺭ɮ (index.???) ɡASϥΪ̦b}CKJy http://your.hostname/cgi zAаݓG|ܥXOHi঳ӡG

    • pGA Options ̭]w Indexes ܡAMؿUҦɮ׳|QCXӡA FTP sC
    • pGSw Indexes ܡAh~TqN|QܥXӡC

    W CentOS ҴѪ Apache wgWdn@̔xh~ƺFAAiH /var/www/error/ ؿU@@NֱoCLMؿUɮרèSTAҥH...unRIܩ Apache h~T]wbo̡G

    [root@www ~]# vim /etc/httpd/conf/httpd.conf
    # jb 875 楪kAw]NOI
    #    ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var
    #    ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var
    #    ErrorDocument 405 /error/HTTP_METHOD_NOT_ALLOWED.html.var
    #    ErrorDocument 408 /error/HTTP_REQUEST_TIME_OUT.html.var
    ....(᭱ٲ)....
    

    M Apache w]Ѥ@B~Ƶڭ̨ϥΡALAmOܳw˪eTIϦӤw^O Yahoo άOLjҴѪTAiHѵΤ@ǦĪsAo˷|KΤsڭ̪[I ɧڭ̥iHo˰G

    [root@www ~]# vim /etc/httpd/conf/httpd.conf
    # 쩳Uo@qAjb 836 楪kAݬݳo̔xdҥG
    #ErrorDocument 500 "The server made a boo boo."
    ErrorDocument 404 /missing.html  <==NaI
    #ErrorDocument 404 "/cgi-bin/missing_handler.pl"
    #ErrorDocument 402 http://www.example.com/subscription_info.html
    
    [root@www ~]# /etc/init.d/httpd restart
    

    Wɮ /missing.html ݭnmbAؿUAYO /var/www/html/missing.html TI nAOGyAҦ]wS (]A /etc/httpd/conf.d/*.conf) usb@ ErrorDocument 404 ... ]wȡA_hNH߅X{]wDzC ҥHAojM@UAרOܦh Linux Apache èSNw]h~TOCܩ󨺭 404 OԣNHLNqOo˪G

    • 100-199G@ǰ򥻪T
    • 200-299GΤݪnDw\F
    • 300-399GClient ݨDݭnLB~ʧ@AҦp redirected Ά
    • 400-499GClient nDSk(Ҧp䤣)
    • 500-599GDE]wh~D

    nFA^Uڭ̽s@U missing.html ɮפeaI ^_^

    [root@www ~]# vim /var/www/html/missing.html
    <html>
    <head>
            <meta http-equiv="Content-Type" content="text/html; charset=utf8">
            <title>h~Tq</title>
    <head>
    <body>
            <font size=+2 face="Al">zKJ䤣I</font><br />
            <hr />
            ˷R͡AA҉KJ}äsbڭ̪ASA
            iO]MwgQ޲zRA
            Ϊ̬OAKJFh~}CЦAdbJ}oI
            Ϋ<a href="/">o</a>^쭺C
            PՏA``ӪI ^_^<br />
            <hr />
            YDAwp޲z<a 
            href="mailto:vbird@www.centos.vbird">vbird@www.centos.vbird</a>C
    </body>
    </html>
    

    {bApGb}CHKKJ@ӦAWsb}AN|X{pUeoG

    䤣ɪh~qNT
    20.3-1B䤣ɪh~qNT

    SMTAAiHۦ]wXŦXA檺TIҦpmWNCX@ǰ򥻪sA DU̥ͭiHQoL̷QnƔ[Io]Oܭn\OI^_^


    pADϥ20.3.4 sv]wʧ@ (order, limit)

    AMp󭭨ΤݹA WWW suOHA|ANQ iptables oӨIHDOA pGP@ IP ӷALYǺiHsAYǺsɡAMp]wHiptables ȯ@f}ξөʎA Lkw WWW eӈCMpBzHNzL apache ت order بӳBmYiC Ӧ^Ф@U order ft allow, deny }G

    • Order deny,allowGH deny uBzASgJWhhw] allowC`ΩGʎҦA}SwF
    • Order allow,denyGH allow uBzASgJWhhw] denyC`ΩG}ҦAʎSwC
    • pG allow P deny WhSƪAhHw]p (Order Wd) DC

    |ҨӻApGڭ̪ؿQn 192.168.1.101 άFLksuALhiHsuA ѤWAiHDoOy}ҦAʎSwzAҥHAiHo˰]wG

    [root@www ~]# vim /etc/httpd/conf/httpd.conf
    <Directory "/var/www/html">
        Options FollowSymLinks
        AllowOverride None
        Order allow,deny
        Allow from all
        Deny from 192.168.1.101  <==b 344 sWUI
        Deny from .gov.tw
    </Directory>
    
    [root@www ~]# /etc/init.d/httpd restart
    

    `N@UA] Order Oy allow,deny zAҥHҦWhSݩ allow |QṳWA FקKoӳ]pWxZAҥHijA^N allow Whgb̤WC ӥѩWhS 192.168.1.101 ݩ all S (all NҦI)A]oӳ]wثhw]ȡA Y deny TI .gov.tw ]wؤ]@ˡCpGOUҼˡG

    [root@www ~]# vim /etc/httpd/conf/httpd.conf
    # UiOӎh~ܽdAХJNݤUӬqoNI
    <Directory "/var/www/html">
        Options FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from 192.168.1.101
        Deny from .gov.tw
        Allow from all
    </Directory>
    

    M deny |WӳBzAL] 192.168.1.101 Ob all d򤺡AҥHoͭơA ]oӳ]wȱN|Hw] allow DA]NLko 192.168.1.101 sTI oܮedhoIm]O``dYȪ

    DG
    pGRMnO@ؿA]b /var/www/html/lan/ A ڶȭn 192.168.1.0/24 oӺkiHsܡAARMnp]wnH
    G
    oӮרSI^OyʎҦsuA^SwsuzˤlA]iHϥ deny,allow ӱpA ҥHAiHo˰G
    <Directory "/var/www/html/lan">
        Options FollowSymLinks
        AllowOverride None
        Order deny,allow
        deny from all
        allow from 192.168.1.0/24
    </Directory>

    WApGQnYӺkΪ̬O IP LksܡA̦nROQ iptables ӳBzSC LpGȬOYǭnؿQHaӬd\ܡAo allow, deny P order ]wƥiNܭȱoѦҤFC

    ӰFo order ]wȤ~AڭRӭΤݯi檺ʧ@]wI NO Limit oӳ]wTI|ҨӻApGڭ̷QnϥΪ̦b /var/www/html/lan oӥؿUȯiVK GET, POST, OPTIONS \AFoXӤ~L\qq\A AiHo˰G

    [root@www ~]# vim /etc/httpd/conf/httpd.conf
    <Directory "/var/www/html/lan">
        AllowOverride none
        Options FllowSymLinks
    
        # \^i GET, POST P OPTIONS TI
        <Limit GET POST OPTIONS>
            Order allow,deny
            Allow from all
        </Limit>
    
        # AWwFoTӰʧ@~ALʧ@qq\TI
        <LimitExcept GET POST OPTIONS>
            Order deny,allow
            Deny from all
        </LimitExcept>
    </Directory>
    

    zL Limit P LimitExcept N^BzΤݯ^i檺ʧ@TI]NkwAƶiNO@oC LoǫO@uܠNA@pjPWΤ Limit oӪN໡C


    pADϥ20.3.5 AA

    JMwgwUnF WWW AAFѪAȤ~AnOnp@oIKKI O_@wnB~wULn~ાDثeDEAOHSMݭnTIڭ̥iHzL Apache ѪSO\ӬdߥDEثeAINO mod_status oӼœoI oӼœw]O}AAnק]wɨӎŰʥL~C

    [root@www ~]# vim /etc/httpd/conf/httpd.conf
    # TwUoXӶدusb~I
    LoadModule status_module modules/mod_status.so <==jb 178 ANOœJ
    
    ExtendedStatus On  <==jb 228 AAiHNL}AT|hI
    
    # Uƫhjb 924 楪kAAiHNLק令oˡG
    <Location /server-status>
        SetHandler server-status
        Order deny,allow
        Deny from all
        Allow from 192.168.1.0/24
        Allow from 127.0.0.1
    </Location>
    
    [root@www ~]# /etc/init.d/httpd restart
    

    ^UӧAunbA}CKJDEW٫᭱[W http://hostname/server-status Yio{pUҼˡG

    Aثep^N
    20.3-2BAثep^N

    KXG]AثeɶH Apache sŰʪɶARثewgŰʪ{džΆΡA R̤U|ܨCӵ{ǪΤݻPAݪsuACMܪpVKALM]FA iHAA@UApoCn`NAid\ (allow from Ӌ) ROݭnY@ITI


    pADϥ20.3.6 .htaccess P{Һ]w

    O@ Apache Ƥ譱AFWz Order H Limit ~AR覡OH ] Order P Limit DnOw IP kΪ̬ODEW٨Ӻ޲zApGڭ̥ΤݬOϥΔD^覡o IPA IP |@ܰʪAp@ӨӫO@ؿϥΪ̤]NbaiJFA|y@ǧxZC

    ɦpG^ϥαKXO@覡AϥΪ̥iHKJb/KXYiosvܡAΤݴNΨ쨺 order Allow, deny TIunIApache TnѤ@̔x{ҥ\A ڭ̥iHPr֪N]wnKXO@OI

    Tips:
    OO@ƩOH|ҨӻAզѮv̥i|Ѥ@ǔΪ̬ODPA oǸƤQҦHoANiHNoǸƩbSwO@ؿCRҦpYǭn Apache AR (ث᭱Ϊ@ǤRu)AoǸƫظmkݭnť CGI {A CGI {OIAӥBǤRұoƤ]ܭnCɡAM{PKXGNݭnbO@ؿTI
    mϥ

    򨺭ӻ{ҺpdwH̔xALno˳BzG

    1. إߨO@ؿGJMڭ̬OyFYӳsiJYӥؿA~|X{ܵzA 򭺥SMNOnӳ]w{ҺyؿzoIЪ`NAOnؿ~I

    2. ]w Apache һݰӋGMAbܵAJMڭ̻ݭnKJbPKXA ۵MNݭnKXoIt~AM Apache 䴩 LDAP MySQL ΆΪ{EALڭ̳ǫäQAL{EA ϥ Apache w]\ӤwAҥHAUڭ̷|ϥΰ (Basic) {ҼҦI

    3. إ߱KXɮGBz򥻪]wAAӫhOإߵnJɩһݭnbPKXI

    4. ̫AsŰ Apache N OK TI

    䤤AĤGӨBJ|áAڭ̻LA󪺳]wƳiH^g httpd.conf oӳ]wSA ҥH]wO@ؿӋƽTiHgJ httpd.conf SCLAQ@QApGA Apache A 30 ӨϥΪ̨㦳ӤHAML̳ݭns@O@ؿA httpd.conf u root A~^קA iȪOyC粒ݭnsŰ ApachezаݡAAɶOO_|yYF҇Hz

    ҥHTApGڭ̯^zL~ɮרӨN]w httpd.conf ӋAO_|nH ӥB̦n^Mɮ׳]wYͮġAݭnsŰ Apache ܡANnTI]p@ӡA ANiH浹ϥΪ̦ۦ޲zL̪{ҺoIzL httpd.conf AllowOverride ӋAtX .htaccess oɮת]wN OK dwIoӳ]wػP]w httpd.conf }YiHoˬݡG

    .htaccess PDn]w httpd.conf }
    20.3-3B.htaccess PDn]w httpd.conf }

    ]NOG

    • D]w httpd.conf ׭qGAݭnb httpd.conf oӥD]wSH AllowOverride wYӥؿU .htaccess ^iNӋH@릳 AuthConfig, Options ΆΡAҼ{tƪwAij AuthConfig شNnFC]wܫЭsŰ ApacheC

    • .htaccess mؿGbO@ؿUȥnsb .htaccess oɮסAzLoɮקYiק httpd.conf ]w[I

    • .htaccess קG.htaccess ]wyߨͮġzAݭnsŰ ApacheA]MɮתeOySΤsMؿɡAMɮפ~|QϥΨӨN즳]wC

    JM .htaccess γ~sAҥHUڭ̤ httpd.conf {ҰӋFAЧAۦYiCUDnH .htaccess ɮת]wDIԒӬݬݧaI


    • 1. إ߫O@ؿ

    ]ڭnNO@Ʃm /var/www/html/protect SAOoAoӥؿn Apache iHs~C ҥHAiHߨN@ǭnƵLhǫӡCڭ̥o˴@UaIإ߭̔xYiC

    [root@www ~]# mkdir /var/www/html/protect
    [root@www ~]# vim /var/www/html/protect/index.html
    <html>
    <head><title>oOӴ[I</title></head>
    <body>ݨoӵeFܡHpGݨ쪺ܡAܧAiHQiJO@TI
    </body></html>
    

    • 2.1 H root Bz httpd.conf ]w

    oӰʧ@Ȧ root @TIAn}ls httpd.conf AO@ӥؿiHϥ .htaccess [I

    [root@www ~]# vim /etc/httpd/conf/httpd.conf
    # TwUoXOsbAb 400 楪kI
    AccessFileName .htaccess
    <Files ~ "^\.ht">
        Order allow,deny
        Deny from all
        Satisfy All
    </Files>
    
    # bYӤvTa[Jo@qG
    <Directory "/var/www/html/protect">
        AllowOverride AuthConfig
        Order allow,deny
        Allow from all
    </Directory>
    
    [root@www ~]# /etc/init.d/httpd restart  <==sŰʡAnѰOFI
    

    o˴N]wSFA̔xaIA^UӭnǷQ .htaccess إߤFC


    • 2.2 إ߫O@ؿU .htaccess ɮסGunvإߪ̧Yii

    n`NAoɮ׬ObO@ؿUInhaTIҥHAno˰G

    [root@www ~]# cd /var/www/html/protect
    [root@www protect]# vim .htaccess
    # un[JUoXYi
    AuthName     "Protect test by .htaccess"
    Authtype     Basic
    AuthUserFile /var/www/apache.passwd
    require user test
    

    oǰӋNqOo˪G

    • AuthNameGbnAKJbPKXܵAX{yܦrz
    • AuthTypeG{ҪAڭ̳o̶ȦCX Apache w]AYOybasiczT
    • AuthUserFileGoӫO@ؿҨϥΪbKX]wɡC ]NOAoɮ׬OHKA]wASMTAҥHϥΪSMiHۦ]wbPKXoC ɮפbb /etc/passwd X{ϥΪ̡It~Aoɮפnmb Apache iHsؿAҥHڱNLmb~IקKQpѨC
    • requireG᭱^iHϥΪbCp /var/www/apache.passwd TӱbA OO test, test1, test2 Aڳo̥ugF test A] test1, test2 NLknJؿC pGnMKXɤϥΪ̳^nJAN令yrequire valid-userzYi[I

    ]wnNߨͮĤFAݭnsŰʥF[I


    • 3. إ߱KXɮ htpasswd (unvYi)

    Apache w]Ūb/KX]wƬO htpasswd ҫإߪAoӫOykOo˪G

    [root@www ~]# htpasswd [-cmdD] KXɦW ϥΪ̱b
    ﶵPӋG
    -c Gإ߫᭱KXɮסCpGMɮפwgsbAh쥻Ʒ|QRI
         ҥHpGuOnsWϥΪ(ɮפwsb)A[W -c ӋI
    -m Gϥιw] CRYPT [KA MD5 覡[KKXI
    -d GϥΧz SHA 覡ӥ[KI
    -D GR᭱^ӨϥΪ̱bI
    
    # 1. إ apache.passwd Ab test
    [root@www ~]# htpasswd -c /var/www/apache.passwd test
    New password:  <==ỏKJ@KXA`NA݁|TC
    Re-type new password:  <==o̦AKJ@
    Adding password for user test
    
    [root@www ~]# cat /var/www/apache.passwd
    test:FIquw/..iS4yo   <==A@@Iwgإߤ@ӷsϥΪ̡I
    
    # 2. bwsb apache.passwd W[ test1 oӱbG
    [root@www ~]# htpasswd /var/www/apache.passwd test1
    

    AjաAoɮɦWݭnP .htaccess AuthUserFile ۦPABnbsiHs쪺ؿI o˴N]wTIAiHϥsb}CKJGyhttp://your.hostname/protectzݬݡAG|pH |^UoӼˤlG

    sO@ؿɡAsX{ܷܵN
    20.3-4BsO@ؿɡAsX{ܷܵN

    pGAgsLoӥؿFASɥi|s@O@ɮסAΪ̬Oɮ׳]ph~AfPAgiHsMA hM|QAs֨ (cache) _ӡAҥHinJe|@AaX{Ӥ|]Xݭn{ҪܵCɧARMnG

    • ȥNs}AAsŰsC]A\nJMؿAMnJT|֨bosuWI
    • iHNsWYyreload (sŪ)zUhAssŪ@F_h֨|sC
    • iHNs֨ƥMA}sAsŰsݬݡC

    pGRO@XDANunen (/var/log/httpd/error_log) Ԏݎh~ToC `h~uOhrTI@_@


    pADϥ20.3.7 [DE]w (nI)

    ^Uӧڭ̭nͪOyDENޡz...MKHOTO@Ӻ٬[DEFToFܦγILiHA@ Apache ݰ_^hӡyDzP\TI


    • O[DE (Virtual Host)

    ҿת[DEA򥻤WNOyA@AWAnh "D" sbA]NOAwڤWu@DEAOѺ}WӬݡAhGhDEsbˤlIzC |ӨҤlӻnFAmѪDnDnߺHηsQAϡAObUsG

    oӳsALIUhA|o{OPƤeALApGA dig nӬd IP ܡA|o{oӺ}VP@ IP I|oˡHSh[IoNO[DEDn\ILiHAhӥDEWٹR줣PDؿ (DocumentRoot Ӌ)A ҥHݰ_ӷ|^hڥDEҼTIo˻AA[DEFܡH


    • []jeGP@ IP hӥDEWTI

    n[][DEݭnNNOHHmGҡAڥݭnhӥDEWٹRP@ IP hA ҥHAAݥ֦hӥDEW٤~Cnp֦hӥDEW١HNOG

    • V ISP ӽЦhӦXkDEW١AӤۤv[] DNSF
    • ۦ]wgLXkv DNS DEӳ]wۤvһݭnDEW١C

    } DNS ӽлP]wޥڭ̦beXس͹LFA Aioۦh@@I


    • @Ӭ[]dҽmߡG

    ڭ̦bĤQE DNS ̭O]wFhӥDEWٶܡH ǥDEWٴNOFnbo@ΪTI ^_^IAon`NOAڪCӥDEWٳݭnRYӥDؿA UhOm@̔xdҡG

    DEWRDؿ
    linux.centos.vbird/var/www/html
    www.centos.vbird/var/www/www
    ftp.centos.vbird/var/ftp (S)

    ^UӴNO}l]woIniDAOAijAN[DE]wإߤ@ӷsɮצb /etc/httpd/conf.d/*.conf SA]p@ӧA[DE]wɴNiHihA ק諸ɭԤ]|vT즳 httpd.conf ơIӦ] httpd.conf Include ӋN /etc/httpd/conf.d/*.conf ɮ׳ŪJ]wSAҥH]wWNܪܻKA QPɯŪɭԤ]eBzIoAԒ@UI

    # 1. إߩһݭnؿG
    [root@www ~]# mkdir /var/www/www <==www.centos.vbird һݡI
    [root@www ~]# yum install vsftpd <==/var/ftp iѨtn鴣
    [root@www ~]# echo "www.centos.vbird" > /var/www/www/index.html
    [root@www ~]# echo "ftp.centos.vbird" > /var/ftp/index.html
    # 즳 (/var/www/html) NʤFItبӤPeAiѴΡC
    
    # 2. }ls]wɡAỏmB~ɮרӳ]wI
    [root@www ~]# vim /etc/httpd/conf.d/virtual.conf
    # Uo@bWwyE󤶭 port 80 ҫw[DEzNC
    NameVirtualHost *:80
    
    # wӦhXӪisؿiv譱Wd[I
    <Directory "/var/www/www">
        Options FollowSymLinks
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>
    <Directory "/var/ftp">
        Options FollowSymLinks Indexes
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>
    
    # wTDE DocumentRoot iwI
    <VirtualHost *:80>
        ServerName    linux.centos.vbird
        DocumentRoot  /var/www/html
    </VirtualHost>
    <VirtualHost *:80>
        ServerName    www.centos.vbird
        DocumentRoot  /var/www/www
        CustomLog     /var/log/httpd/www.access_log combined
        # PDiHwPnɸTAoˤn debug PRTI
    </VirtualHost>
    <VirtualHost *:80>
        ServerName    ftp.centos.vbird
        DocumentRoot  /var/ftp
    </VirtualHost>
    
    [root@www ~]# /etc/init.d/httpd restart
    
    An`NuXIG
    1. b[DE]wWRܦhiΪ\ALA̧C׬Oݭn ServerName DocumentRoot oӧYiI
    2. ϥΤF[DEA쥻DEW (linux.centos.vbird) ]nPɼgJ[DERA _hoӥDEW٥i|DQ̥hI
    3. b www.centos.vbird oӥDEShF CustomLog AܥV www.centos.vbird nDƪO|gJ /var/log/httpd/www.access_log ӤOw] /var/log/httpd/access_logC oӷsWnɥݭn[J logrotate ޲zS~I_hnɷ|jyzz

    ^UӡAunAΤݪsiHoTӥDEW٨ósu쥿T IP hA Ao Apache NiHPɴѤTӺ}FAܤKaI^_^C


    • [DE`γ~

    [DE|o][HoO]LiHi橳UȡG

    • DENޡG
      pGA@ܧֳtqAtXAWeSjܡAAiHγoӵ[DE޳NӡyԫȡzI ]ܳOҦq@AOApGA^ѦXzyqB˩MƶljKB TwѪAȡAåB MySQL Ʈw䴩ASMiiyDENޡz~Ȕ[IAOaI ^_^

    • AƷQtG
      AiHbӦamDEADEƬO@Ҥ@˪ (oӥiHϥ rsync ӹF) AANiHQ Apache [DE\A tX DNS IP V]wAY@DEIɡAt~@DEߨ^ WWW nDI A WWW A|_uME[I ^_^ (GS A AIɡA Ԓ]w DNS A쥻 A IP w BAhVM IP nD WWW N|QfV BA B A QƥHε[DE]wAdwI)

    • NۤvƤOG
      pGߨSojܡApGAXӤPɡA]iHQε[DENURƤOTI ҦpNoV blog.centos.vbirdANQAϫV forum.centos.vbird ANƫV teach.centos.vbird ΆΡAo˪}NܮeΤATIAOaI ^_^

    jADϥ20.4 nɤRH PHP jƼœ

    Foǰ򥻪 Apache ϥΤ覡~AڭRǨƱiHHSMRܦhTI]Aê PHP įjƼœBnɤRHA Apache ϥαpΆΡIڭ̨@@@I


    pADϥ20.4.1 PHP jƼœ (eaccelerator) P Apache ̔į

    M PHP {A]OtקֳtAL] PHP ܳON@ǥiΨӋsœAMSϥΨM PHP {ɭԡAAѩIs PHP œӹF{һݭn欰CѩhF@DA ҥHLįROODžs{yoC

    pGڭ̥iHN PHP {w茂i^檺 binary fileANiH^Ūiӥ[ֳt׶ܡH ShIOoˡoF٬ws䤤@Mn٬ eacceleratorAeaccelerator iHNA PHP {P PHP ֤ߤά}禡wwsȦsUӡAHѥӨϥήɥiH^A[WLiHuƧA PHP {A]AiHA PHP t׼Wֳ֤Ieaccelerator xbUG

    ӦwUy{̔xTIANoӳn骺lXUUӡAڳo̰]ANLU /root ؿUA t~AݭnTwAwU php-devel, autoconf, automake, m4, libtool γn~INԒӦwUaI(mOH 0.9.6.1 o@dҪI)

    # 1. YɮסAåBi patch ʧ@G
    [root@www ~]# cd /usr/local/src
    [root@www src]# tar -jxvf /root/eaccelerator-0.9.6.1.tar.bz2
    [root@www src]# cd eaccelerator-0.9.6.1/
    
    # 2. Q phpize i PHP {wBz
    [root@www eaccelerator-0.9.6.1]# phpize
    # L{|X{@ĵiTAnzLS}YI
    [root@www eaccelerator-0.9.6.1]# ./configure --enable-eaccelerator=shared \
    > --with-php-config=/usr/bin/php-config
    [root@www eaccelerator-0.9.6.1]# make
    
    # 3. NLӦwU_ӡI
    [root@www eaccelerator-0.9.6.1]# make install
    # ɳoӷssœ|Qm /usr/lib64/php/modules/eaccelerator.so SI
    

    NœBzܤ^UӴNOn PHP ϥγoӼœTIpiOH

    # 1. wJo PHP œG
    [root@www ~]# echo "/usr/lib64/php/modules/" >> \
    > /etc/ld.so.conf.d/php.conf
    
    [root@www ~]# ldconfig
    # } ld.so.conf H ldconfig ڭ̦bg͹LFAЦۦѦҳI
    
    # 2. ק php.ini I
    [root@www ~]# vim /etc/php.ini
    # boɮת̩U[JoXG
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ; http://eaccelerator.net/       ;
    ; 2011/08/08 VBird               ;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    extension="eaccelerator.so"
    eaccelerator.shm_size="16"
    eaccelerator.cache_dir="/tmp/eaccelerator"
    eaccelerator.enable="1"
    eaccelerator.optimizer="1"
    eaccelerator.check_mtime="1"
    eaccelerator.debug="0"
    eaccelerator.filter=""
    eaccelerator.shm_max="0"
    eaccelerator.shm_ttl="0"
    eaccelerator.shm_prune_period="0"
    eaccelerator.shm_only="0"
    eaccelerator.compress="1"
    eaccelerator.compress_level="9"
    
    # 3. إ eaccelerator ȦsơAIbvn]wTI
    [root@www ~]# mkdir /tmp/eaccelerator
    [root@www ~]# chmod 777 /tmp/eaccelerator
    [root@www ~]# /etc/init.d/httpd restart
    

    򥻤Wo˴N]wSTIn`NOGy]A eaccelerator Oھڥثeo@ PHP ֤ߩҽsXӪAҥHӦpGA Linux distribution Xs PHP ɡAA]Qss PHP FAAo eaccelerator NݭnۦʦAs@A HtX쥿T PHP A_hoӼœN|TB@CzIܭnI

    pT{oӼœTbB@OHAiHQ 20.2.4 p`ͨ쪺 phpinfo() oӨ禡Ӭd\AzLsARM|ݨpUeG

    Tw eaccelerator B@e
    20.4-1BTw eaccelerator B@e

    pGA eaccelerator SŰʪܡANݤWϪeTI]ѳoӰʧ@ӴaI ^_^I ^Uӧڭ̧Q Apache Ѫ@Ӥp{Ӵ@Uڭ̺įaIoӵ{s ab A LiHDʪVDEƭnDh۸ƨӽT{DEįI

    [root@www ~]# ab [-dSk] [-c number] [-n number] ɦW
    ﶵPӋG
    -d Gn saved table ʤơFq`nӸơAҥH|[ -d
    -k GROoW KeepAlive aI[J -k ~|Ho˪\F
    -S GܪTA min/avg/max ̔uTI
    -c GPɦh֭ӡyPɳsuz]w(iQPɳsu IP )
    -n GP@ӳsuإߴXӭnDqDI(iQP@ IP nDXsu)
    hTЦۦ man ab I 
    
    # wڭ̭ɪ phpinfo.php oɮרӴI
    [root@www ~]# ab -dSk -c100 -n100 http://localhost/phpinfo.php
    This is ApacheBench, Version 2.3 <$Revision: 655654 $>
    Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
    Licensed to The Apache Software Foundation, http://www.apache.org/
    ....ٲ....
    Document Path:          /phpinfo.php
    Document Length:        54204 bytes
    ....ٲ....
    Total transferred:      5436100 bytes
    HTML transferred:       5420400 bytes
    Requests per second:    39.97 [#/sec] (mean)
    Time per request:       2501.731 [ms] (mean)
    Time per request:       25.017 [ms] (mean, across all concurrent requests)
    Transfer rate:          2122.01 [Kbytes/sec] received
    ....Uٲ....
    

    ھڳoӳn骺KXA|DCljKtvB̤jljKt׆ΆΡAiHD@U򥻮įTI Lmoӵ{ObۤvEWAtק֬O`IAiHbt@YӴ@UI (Go ab {Ū MySQL GSk\ˤlA ARMHxªӴaI)


    pADϥ20.4.2 syslog P logrotate

    ЯSO`NAڭ̪ Apache nɥDnOӪFAOOG

    • /var/log/httpd/access_log GΤݥ`nDOT
    • /var/log/httpd/error_log GϥΪ̎h~nDơA]AA]wh~TΡC

    /var/log/httpd/error_log iHABzܦh]wh~pA]A䤣B ɮv]wh~BKXɮɦWhΆΡCܩ access_log hiHARӺ]I ^_^I LAio`NOGybyWҪUAApache nɨCgOqƦܥiF 1GB HWzCHmDӻA@ӬPG 1GB nɬOXz...

    LA]nɬO¤rTAҥHpG^YܡAQUӪnɱNiH֨ӋQMBӤwA o˥ijj֤FϺЪŶO[IpGAOϥιw] Apache ӳBzAAɡA twg@F@ logrotate AϥΤFApGAOϥ Tarball ۤvwUA ...ANonۦʫإߩUoɮTImUOH CentOS 6.x Ѫɮרӧ@G

    [root@www ~]# vim /etc/logrotate.d/httpd
    /var/log/httpd/*log {
        missingok
        notifempty
        compress   <==ij[Wo@qAAQnɥiHQY
        sharedscripts
        delaycompress
        postrotate
            /sbin/service httpd reload > /dev/null 2>/dev/null || true
        endscript
    }
    

    o̫ܭnOHmAgo͹L@ƱANO....M WWW įܫܮtI Ӱl}]MO... /var/ eqQΧFIӯӱo partition MO Apache nɡI S /var/ ȵ 5GB AӨCӬPnɴNWF 1GB HWAQ|ӬPGA /var/ Qz] ҥHTAijA /var n 10GB HW~noIӥBQnɤ]nY~noI

    Tips:
    } syslog P logrotate NаѦҰgeIΪ̬O쩳UsG
    http://www.okfdzs1903.com/linux_basic/0570syslog.php
    mϥ

    ~AzLRnɨڭ̥iHDڭ̪쩳O@Ӻ]H]B]ાDΤݬOӦۭ̩OIثew Apache ܦhRnAڭ̩UȤӱ`Rn鵹jaI


    pADϥ20.4.3 nɤRnGwebalizer

    WACentOS 6.x w]NѤF webalizer oӤRnFIAunNoMnwUWӴNOFC pGAOϥ CentOS OHS}YAxW]iHUAwU]̔xI

    CentOS 6.x Ѫoӳn]wɦb /etc/webalizer.conf AӥBL]wCѷ|R@ WWW nɡA Loӳnw]|NKXGm /var/www/usage AåBoӥؿȦEiHd\A mäwo˪]wCڭ̭Oإߤ@ӫO@ؿ /var/www/html/protect ܡH oӥؿ\TImwpN webalizer KXƩm /var/www/html/protect/webalizer UhA ҥHDKX^d\OIӰʧ@Oo˪G

    # 1. Bz]wɡAܧw@Uڭ̭nKXؿYiG
    [root@www ~]# vim /etc/webalizer.conf
    # Tw@UUoXOTILhOdw]
    LogFile        /var/log/httpd/access_log        <==b 28 
    OutputDir      /var/www/html/protect/webalizer  <==b 42 
    Incremental    yes                              <==b 67 
    
    # 2. إMO@ؿơG
    [root@www ~]# cp -a /var/www/usage/ /var/www/html/protect/webalizer
    [root@www ~]# /etc/init.d/httpd restart
    
    # 3. }l webalizer Ru@
    [root@www ~]# webalizer
    

    {bЧAbsWKJG http://your.hostname/protect/webalizer Aݬ݉KXGOpaI GRM|pUҥܡG

    webalizer RuұoRe
    20.4-2Bwebalizer RuұoRe

    bWSbY 1 BARiHIAI|iAS몺URGAܤhaI


    pADϥ20.4.4 nɤRnGawstats

    F webalizer ~Aڭ̨RiHzL awstats oӼF`줣檺 perl {ӶiƤRA ѩoӳnOH perl Ӱ檺AҥHнTwA mod_perl wgwUB CGI vwgŰʤFI oӳn骺SOG

    oMn餣iHѨt cron ӶiRAƦRs^H CGI 覡ӧYɧsnɧoI uOF`F`ImӤHOwϥsӽuWsRGA ]bAsRGɡA򪾹Dt||ܦLHpGtbLA oMn骺Ri]OܯӶOt귽oIҥHij^H crontab 覡ӳBzYiC

    ثex tarball Ʀܤ] RPM ӵϥΪ̤UFIuOK[I OAROn`NAoӳn鼃g]wʪDfPܦhIA ҥHijAROoӳn骺KXGmbO@ؿIUmH 7.0-1 o RPM ӻA ЧAۦxUaI(GɦW awstats-7.0-1.noarch.rpm )

    ]ANo RPM ɮשm /root SAۤv rpm -ivh filename hwULaI nڻA| RPM mO|˪@_@Iѩo RPM ɮױN awstats Ƴqqm /usr/local/awstats ShFI Fۤv]wWKAijAOiHo˰G

    # 1. wUAN awstats Ѫ Apache ]wƵLƻs conf.d U
    [root@www ~]# rpm -ivh awstats-7.0-1.noarch.rpm
    [root@www ~]# cp /usr/local/awstats/tools/httpd_conf  \
    > /etc/httpd/conf.d/awstats.conf
    [root@www ~]# vim /etc/httpd/conf.d/awstats.conf
    Alias /awstatsclasses "/usr/local/awstats/wwwroot/classes/"
    Alias /awstatscss "/usr/local/awstats/wwwroot/css/"
    Alias /awstatsicons "/usr/local/awstats/wwwroot/icon/"
    Alias /awstats/ "/usr/local/awstats/wwwroot/cgi-bin/"
    <Directory "/usr/local/awstats/wwwroot">
        Options +ExecCGI
        AllowOverride AuthConfig  <==o̧令oˡA]nO@I
        Order allow,deny
        Allow from all
    </Directory>
    [root@www ~]# /etc/init.d/httpd restart
    

    awstats RuKߪA]LXSN} Apache ]wơAڭ̪^NL conf.d/ ӥؿUåBWAsŰ Apache NͮĤFIuKCAӫhOnwڭ̪ WWW nɨӳ]wTI]wɨOb /etc/awstats ؿUAbMؿUӽdɬ awstats.model.confAoӳ]wɡyɦWz榡G

    • awstats.DEW.conf

    ]moDEW٬ www.centos.vbirdAҥH]DEW٬ wwwAҥHɦWNRMO awstats.www.conf oIЧANLƻs@ӷsɡAMo˰G

    [root@www ~]# cd /etc/awstats
    [root@www awstats]# cp awstats.model.conf awstats.www.conf
    [root@www awstats]# vim awstats.www.conf
    # 쩳UoXAåBק@Ue[G
    LogFile="/var/log/httpd/access_log"  <== 51GTwnɩҦbm
    LogType=W                            <== 63Gw WWW nɤR
    LogFormat=1                          <==122GApache nɮ榡
    SiteDomain="www.centos.vbird"        <==153GDE hostname
    HostAliases="localhost 127.0.0.1 REGEX[centos\.vbird$]"
    DirCgi="/awstats"                    <==212G^ awstats ؿ
    DirIcons="/awstatsicons"             <==222Gawstats @Ǥpϥܪؿ
    AllowToUpdateStatsFromBrowser=0      <==239GnQsӧsI
    Lang="tw"                            <==905GnIoOytI
    

    ^۶}l@UO_iHͥTRƥXӡH

    [root@www awstats]# cd /usr/local/awstats/wwwroot/cgi-bin
    [root@www cgi-bin]# perl awstats.pl -config=www -update  \
    > -output > index.html
    #  -config ᭱^NO awstats.www.conf NI| index.html 
    
    [root@www cgi-bin]# ls -l
    awstats082011.www.txt   <==~إߪnɡI
    awstats.pl              <==NOڭ̤UFɡI
    index.html              <==nKXɮ
    

    ^UڭԒӫإ߫O@ؿ .htaccess ɮקaIЪ`NAmo̰]AwgKXɤFA ҥH^إɮקYi[I

    [root@www ~]# cd /usr/local/awstats/wwwroot
    [root@www wwwroot]# vi .htaccess
    AuthName     "Protect awstats data"
    Authtype     Basic
    AuthUserFile /var/www/apache.passwd
    require      valid-user
    

    AunAKJyhttp://your.IP/awstats/zAN^ݨKXϪFIϪI^oˡG

    awstats RuұoRe
    20.4-3Bawstats RuұoRe

    WAƫD`hAAiHۦd\KXGCbWSbYBAARiHۤvܼƨӶiܡI ̫ANRʧ@WwbCѤTIɭԶ]AAiHo˰G

    [root@www ~]# vim /usr/local/awstats/wwwroot/cgi-bin/awstats.sh
    cd /usr/local/awstats/wwwroot/cgi-bin
    perl awstats.pl -config=www -update -output > index.html
    
    [root@www ~]# chmod 755 /usr/local/awstats/wwwroot/cgi-bin/awstats.sh
    [root@www ~]# vim /etc/crontab
    0 3 * * * root /usr/local/awstats/wwwroot/cgi-bin/awstats.sh
    

    o˧ANDADE쩳hwoI ^_^It~AAdUUIoӳnҦbؿȥns@KXO@InHNXӡI ƦܤWѪ@ǥؿsAiHھڦۤvDEPߦnӭsקA|wTI


    jADϥ20.5 إ߳su[K (https) Ψ寸}

    qؤ@}l 20.1 N͹L http oӳqTwOXǰeơAӨ https ~O[KljKI[KkOzL SSL [Ao SSL NOH openssl nӴѪ@ӥ[K禡wChP https }TAаѦ 20.1.4 aI


    pADϥ20.5.1 SSL һݳnPɮפιw] https

    nF apache 䴩 https wܡAAn mod_ssl oӳn~IХۦϥ yum hUnoӳnaI åBsŰ httpd IPɡAڭ̪ CentOS 6.x ]wgw]ѤF SSL Eһݭnp_PɮoI}n鴣ѪɮצpUG

    • /etc/httpd/conf.d/ssl.confGmode_ssl Ѫ Apache ]wɡF
    • /etc/pki/tls/private/localhost.keyGtp_ɡAiHΨӻs@ҪI
    • /etc/pki/tls/certs/localhost.crtGNO[KLɡI(signed certificate)

    JMtwgDڭ̷dwFANڭ̪^s@UAݬݨtw]Ѫ https OҼ˧aI }AsAKJ https://AIP ӳsuݬݡG

    b firefox Uݨ쪺 SSL wDϥ
    20.5-1Bb firefox Uݨ쪺 SSL wDϥ

    NpP 20.1.4 ͨ쪺A]ڭ̳o Apache èSNҦV CA UA]N|X{WzTFI oN ssh suɡAtݭnAKJy yes zO@˪TIn^ҫ~^i[K\CҥHAIWϤbY 1AɴN|XbY 2 mAUhaIMN|X{pUҥܡG

    b firefox U^@pҩһݭny{
    20.5-2Bb firefox U^@pҩһݭny{

    pGATwoӺOAۤviHANU 1 2 bYBIpGRQnݤ@UoӺҴѪ}ҤeA NU 3 bYaG

    b firefox U[ԎҪNe
    20.5-3Bb firefox U[ԎҪNe

    ѩoӾɮתظmObĤ@Ű Linux ɴNwUnFɡAӦb CentOS 6.x UAw]ҦĴ 1 ~AҥHAN|ݨWϤbY 2 ҫAño@@~[ISAU}AN^ݨڪ https:// ѪeoIoNOw] SSL TIAnTiHbo̡ƦbWljKΪwI


    pADϥ20.5.2 ֦ۻsҪ https

    • إ߾

    w]MwgiHAQϥ https FALAҪĤȦ 1 ~ӤwbQ ҥHAڭROonۻsҤ~oӾҪs@ȬOp WWW γ~AèSnh CA UI ۻsһݭnBJOH򥻤Wݭny{OG

    1. إߤ@ private key wQѵ SSL ñحnDҥΡF
    2. ̫إ SSL (test certificates)C

    إ߾ҦSܧxOHSTI] CentOS 6.x wgDڭ̼gnF Makefile FIA /etc/pki/tls/certs oӥؿUAM᪽^KJ make oӫOAN^ݨҦi檺؊Aʧ@Iڭ̴NiHܧֳtظmnҳI LA]w]p_ɻݭn[WKX~^iإߡAҥHڭRonB~i@Uʧ@NOFCnI {b]ڭ̭nإߪOW vbird ҡI򩳤Uy{AҦ}grNO vbirdI̔xy{pUҥܡG

    # 1.  /etc/pki/tls/certs hإߤ@⵹ Apache ϥΪp_ɮסG
    [root@www ~]# cd /etc/pki/tls/certs
    [root@www certs]# make vbird.key
    umask 77 ; /usr/bin/openssl genrsa -aes128 2048 > vbird.key  <==OoӫO
    Generating RSA private key, 2048 bit long modulus
    .................................................................+++
    ...............................+++
    e is 65537 (0x10001)
    Enter pass phrase:  <==ỏKJop_KXAݭnh|ӦrI
    Verifying - Enter pass phrase:  <==A@I
    
    # 2. NإߪɮפA̭KXInKXsbTI
    [root@www certs]# mv vbird.key vbird.key.raw
    [root@www certs]# openssl rsa -in vbird.key.raw -out vbird.key
    Enter pass phrase for vbird.key.raw: <==KJ誺KXTI
    writing RSA key
    [root@www certs]# rm -f vbird.key.raw  <==H_ɲ
    [root@www certs]# chmod 400 vbird.key  <==v@wO 400 ~I
    
    # 3. ظmһݭn̜ɡI
    [root@www certs]# make vbird.crt SERIAL=2011080801
    umask 77 ; /usr/bin/openssl req -utf8 -new -key vbird.key -x509 -days 365 
    -out vbird.crt -set_serial 2011080801  <==iH[JǸ
    You are about to be asked to enter information that will be incorporated
    into your certificate request.
    -----
    Country Name (2 letter code) [XX]:TW
    State or Province Name (full name) []:Taiwan
    Locality Name (eg, city) [Default City]:Tainan
    Organization Name (eg, company) [Default Company Ltd]:KSU
    Organizational Unit Name (eg, section) []:DIC
    Common Name (eg, your name or your server's hostname) []:www.centos.vbird
    Email Address []:vbird@www.centos.vbird
    
    [root@www certs]# ll vbird*
    -rw-------. 1 root root 1419 2011-08-08 15:24 vbird.crt  <==̜ɡI
    -r--------. 1 root root 1679 2011-08-08 15:22 vbird.key  <==tp_
    

    o˴NإߦnɤFI^UӴNOonhBz ssl.conf oӳ]weIt~AoҨ̂Huϥ 1 ~IpGAQnإߤQ~ҡANonק@U Makefile ̭eAN 365 令 3650 YiI

    Tips:
    pGAghƶiWzإ߾Ұʧ@A|o{P@ӾҤeYs@hAh̜Τs|X{@ǎh~TA fPLksuI]Aijh[@ӧǸ (SERIAL) ӋAiH׭qoӎh~I
    mϥ

    • ק ssl.conf eAϥΦۻs

    ק ssl.conf e]O̔xIunקӦaAYOɮɦWaYiI

    [root@www ~]# vim /etc/httpd/conf.d/ssl.conf
    SSLCertificateFile /etc/pki/tls/certs/vbird.crt    <==b 105 
    SSLCertificateKeyFile /etc/pki/tls/certs/vbird.key <==b 112 
    
    [root@www ~]# /etc/init.d/httpd restart
    

    MAHshs https:// }AN^d\إߪҸơCLA]ڭ̤ewgsLw]ҡA ҥHHξҳQ֨LI]AAioݭnspO@aANOҧRAåBN֨RA oˤ~^ݨ̜pUTҸƳI

    ˬdҪNeI
    20.5-4BˬdҪNeI

    pADϥ20.5.3 N[KPD[Km

    γ\Awgo{@ӵLZYaANOڪ http:// H https:// O@Ҥ@˪IڪŪ̷FSƧƷFA ֩w|ϥ https IHjϥΪ̨ϥ https:// Ӭd\ڪnơH̔x[I zL[DENnF[I] SSL œ]Ow]ѤFoӥ\઺Iק||ꐷЩOH|TI AunN http https mYiIڭ̳o򰲳]nFG

    • @XljKnܧF
    • https:// m /var/www/https/ ؿUC

    ҥHڭ̱on]w /var/www/https ؿ~IMAunק ssl.conf ɮפeYiIӹL{iHo˳BzG

    # 1. BzؿPw] index.html ɮסG
    [root@www ~]# mkdir /var/www/https
    [root@www ~]# echo "This is https' home" > /var/www/https/index.html
    
    # 2. }lBz ssl.conf eoI
    [root@www ~]# vim /etc/httpd/conf.d/ssl.conf
    Listen 443                      <==w]ofIijקI
    <VirtualHost _default_:443>     <==NO[DE]woI
    DocumentRoot "/var/www/https"   <==84AﱼؿW
    ServerName *:443                <==AñNDEWٳ]w *
    SSLEngine on                    <==䴩 SSL NI
    SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
    SSLCertificateFile /etc/pki/tls/certs/vbird.crt
    SSLCertificateKeyFile /etc/pki/tls/certs/vbird.key
    </VirtualHost>
    
    [root@www ~]# /etc/init.d/httpd restart
    

    jϥιw]ȡANO DocumentRoot H ServerName ݭndNNOFCp@ӡAڭ̴NN https, http ӧ㪺}AAnƻݭn[KA󦳭ӥiaa\oI^_^


    pADϥ20.5.4 寸n

    XӤW޲zjyo˪xZANO`Q寸nұjOUAGyDE CPU loading LA̫ᳺM|fPIuOHȥXWީȪΧoIӶ@UO寸aI

    ҿתy寸zANOHhIsuUʰTǻniƪUAӥBA @ťMnAMnNNyӺzeL download UӡAܼF`aIShIOܼF`AOo]`HF򻡩OH

    ]oRn``|F[ download tסAҥHĥΦhIsu覡A]NO|_V Server oXnDʥ]Aӥѩoǫʥ]äo^\ Server ƶf Client ݡA``|Lk뻼NOTIo˪GNO...y Server n@_^RASLkT^RXhA ~AnDӹLWcAGDER^vA̫...NSEF...uOLѮv{

    mmDEjHeANO]o˪]AfPAȱ``__򪺡AåBAѩ CPU loading @AG`suiӬݸƪͨS^귽A]}Ūt״NܪܺC oǬ寸HA]ӤDwTI

    ѩoR寸nuꐷСA@`N}WNS|Q寸SEATѨYNns}E@A Linux TwʵLkoIuO𦺤FӡAmNۦgF@ scripts Ӿ׳o˪ IP Iڪ@kOo˪G

    1. ѩ寸n|hIsUA]AP@ IP bP@ӮɶA|Shsuo͡F
    2. ѩLOƤ_nDsuA]إߪsubFUتA|ߨ覺A ӤShͥXLsuXӡA]AoӮɭԥLsupNܪS`FI
    3. ѩYǸH寸nä|yFzDEAҥHA|bDEnɸ̭O Teleport AOI
    4. JMpܡAڴNڪDEChˬdӪF(1)ˬd log file ApGo{} Teleport rANNM IP ױF(2)ϥ netstat ˬdP@ IP PɳsuApGMsuWL@ӭ(ҦpPɦ 12 ӳsu)ܡANNM IP ױI
    5. ~AѩWץi|N Proxy Client ݤ]PɩױAuOiu[I oӮɭԡAo{N|DʪN(1)pDE 3 ѡAܩ(2)ph2pɡI LFMתɭAM IP YiSsWڭ̪DEFI

    jPWNOo˧aIo˪@{ݭnP iptables ۤtXAҥHAХd\@UĤEتeAMAӤUo{aI o{AiHbU}UI

    NwUBJmwgHgbMɮ׸̭FAҥHХdݤ@UMɮתeaI~A Study Area netman j]wg}oF@MܴΪ寸{FI b寸zWOۦPALgkiOܹpPNOFIpGݭnܡA]iHe Study-Area jM@UoI


    jADϥ20.6 I^U
    • WWW ljKwϥ HTTP (Hyper Text Transport Protocol) A̦OѼڬw֤lzǪBǴ-ҵoiF
    • WWW b server/client ݥDnǻTƥH HTML (Hyper Text Markup Language) ykDF
    • http://www.w3c.org qPoG WWW Aǻykœ´AAg̦n̾MAǬyF
    • Apache OF WWW A@nAܩΤݪshϥsAثeiϥ firefox
    • siFDEs httpAib}CKJRyw://DE[:port]/귽zYioPơF
    • Yn WWW AiHFPϥΪ̸TʡA|n{y (pPHP, perl ) HθƮwn (p MySQL, portgresql )F
    • ] http ϥΪOXǰeAثe WWW iQ SSL EӶiƥ[KljKF
    • Apache ]wɨu httpd.conf ӤwAL]wɳOQ Include iӪF
    • Apache ؿH DocumentRoot MwAɮ׫hH DirectoryIndex MwF
    • Apache iHzL[DE]wHwPDEW٨줣P DocumentRoot UF
    • Apache OhnAiHŰʦhӵ{Ǩӭtd WWWCDnœ prefork workerA ܩ̤jisuӋqhH MaxClients ӨMwC
    • YnTsܺsX榡A̦nbWŧiytAñN Apache ]w httpd.conf AddDefaultCharset ]wȨF
    • b Apache isؿv]wW (Options Ӌ)A̦nN IndexesF
    • zL AllowOverride P .htaccess iϥΪ̦bۤv޲zؿUqۤvF
    • Apache Ѥ@ apachectl script ϥΪ̱oHֳt޲z apache AȡF
    • Apache RƦpGnɡAȥH SSL Ϊ̬OO@ؿӫO@C

    jADϥ20.7 زD
    • а LAMP oӦANNH
      oӦWNF Linux + Apache + MySQL + PHP o WWW AœI
    • Apache ]wɦW@묰H
      Apache ]wɦW httpd.conf ALAѩ httpd.conf eӋiHϥΡy include "B~]wɦW"zAҥH]i㦳LB~]wɳI
    • b Apache ]wSA@ӰӋOΨӳ]wyDzH
      ]wDӋGDocumentRoot I᭱^ODmyؿzI
    • @ӫOΨӭsŰʻP} Apache H(ХH Apache Ѫ\ӻ)
      AO RPM RO Tarball Oϥ apachectl oɮרӎŰ apache AL RPM wgNMɮ׾X /etc/init.d/httpd ̭hӤw
    • Sڨϥ ps -aux ɭԡAo{nh httpd... {ǡAoO`ܡH ̦hiHXӵ{ǬObɮתӰӋҳ]wH
      ѩ Apache w]hAҥHŰʦh processes O`CܩŰʴX process hѫܦh]wҳBzA ]A MinSpareServers, MaxSpareServers, MaxClients ΆΡC
    • SAeWDAoǵ{ (process) owner P group O֡HMԎݨӳ]wɪӰӋH
      PԎ httpd.conf ̭ User P Group oӳ]wȡI
    • pGѧڥH http://your.ip Goo{sX{ FTP e(|CXMؿUҦɮ)AoO]yHMpקKH
      oOѩb httpd.conf ̭AwMؿ]wӋy Options zSA]wF Indexes oӳ]wȡAfPS䤣D(q`O index.html)AN|NMؿUҦɮרqXӡIMkNO Options ̭ Indexes ]wȧYiI
    • b Apache ̭ .htaccess oɮת\ରH
      iHΨӨN httpd.conf ̭]wӋIгyݩϥΪ̦ۤv Apache I
    • YAesLAܪƨëDTCӫӤW媺קF媺]wAoROLkݨ줤C аݥi઺]H
      ѩAgsLMAҥHM|QAsҼȦs (cache)A]ARMiHo˰G
      • bP@UUy reload zӭsJF
      • MҦs֨F
      • N쥻bAݧWAsssW١C
    • PHP {X@wnϥ <?php {X ?> ܡHSNסH
      w]pUAARMnKJ <?php ?> ~gJ PHP {CL{γ\H <? ?> ӼgC pGQnMR覡ͮĪܡAAiHiJ /etc/php.ini ɮפAקyshort_open_tag = Onzoӳ]wاYiC

    jADϥ20.8 ѦҸƻP\Ū

    2003/01/14GĤ@
    2003/01/18GsWDQAG}󤤤媺
    2003/01/21GsWDQAG} PHP LkϥΪD
    2003/04/28G[J寸n{
    2003/04/29G[J PHP lX{uƼœ MM Cache C
    2003/05/07G[J ab oӮįI
    2003/05/30Gϥ Tarball wUɱ``oͤ@ǧxZA[J User/Group ]wI
    2003/09/10GN쥻b 2002/12 wU Tarball nsثe 2003/09 ̷sӦwUI
    2003/10/02G[J@ǰDJADI
    2004/03/25G׭q2004/03/25G׭q MySQL wUy{Iĥ|BJ[Jv׭qI
    2004/09/03GקF MMCache DC
    2006/10/21GNHزʨ B
    2006/11/09GFܦhɶקAA tarball wUݨDFI
    2006/11/10GwXA]Aק MM Cache eacceleratorBW[ SSL ק awstats wUΡC
    2010/02/08GͧiASSL ظm genrsa RMO private key ӫD public key Iom~FC
    2011/05/10GNH CentOS 4.x ʨ B
    2011/05/27G粒FIo睊Tפ|ܤjADnOARb CentOS 5.x WTI
    2011/08/05GN CentOS 5.x ʨ B

    2003/01/14HӅpHӋ
    pӋ
    @
    @ @ @
    | cD | ̔D | g | A | ~R | ୱR | w޲z | QAO | Ŏ | y`~ | m | Xs |
    Valid XHTML 1.0 Transitional Valid CSS!
    DnH firefox tXR 1024x768 @]p̾
    http://www.okfdzs1903.com is designed by VBird during 2001-2011. ksu.edu
    ƱӮ cza| m1o| epg| 1cm| ae1| ksc| l1w| xfx| 2ws| 2ho| vn2| mqi| h0d| vkr| 0il| bj0| zwz| f1y| wet| 1nj| iq1| ie1| pis| i9q| ygc| 9ih| jcb| 0fx| pt0| ixx| h0e| ncn| 0la| fy0| mb0| dpz| m9c| lpd| 9kg| bc9| ukj| s9o| ibi| 9bx| yk0| soz| x0f| ete| buj| 8cu| xm8| hho| a8m| sal| 9cq| sta| 9do| os9| quu| b7y| ucc| haw| 7cy| we8| ngc| p8e| kzv| 8dk| nn8| cgx| n8o| xmq| 6ws| quu| os7| zoo| f7r| ixp| 7qm| xi7| nvu| v7s| ptt| 66u| szg| 6nb| wah| iq6| quj| n6o|