Uyifaka njani i-web server nge-Nginx + MySQL + PHP5 + APC + Spawn_FastCGI [4th Part: Nginx + PHP with SpawnFastCGI]

Ngethuba elidlulileyo Ndikuxelele malunga noluhlu lwezifundo, kwindlela yokufaka kunye nokuqwalasela iserver kwimfuno ephezulu yokubamba. Eli nqaku liza kuba malunga nokufaka kunye nokuqwalasela Nginx + PHP nge I-SpawnFastCGI:

I-Spawn_FastCGI:

Oku kunokuthiwa yinto edibanisa i-Nginx ne-PHP, oko kukuthi, nokuba ngaba bane-PHP5 package efakiweyo ukuba abanayo i-Spawn_FastCGI efakiweyo kwaye yenziwe xa bevula indawo kwi-PHP isikhangeli siyakukhuphela ifayile, ayizukubonisa kubo nantoni na eyenziweyo .php icwangcisiwe kuba umncedisi akayazi indlela yokwenza iifayile ze-.php, yiyo loo nto kubalulekile ukufaka kunye nokumisela i-Spawn_FastCGI.

Ukuba sisebenzise i-Apache iya kuba yinto elula njengokufaka iphakheji ye-libapache2-mod-php5 kodwa kuba sisebenzisa i-Nginx kuya kufuneka sifake iphakheji ye-spawn-fcgi endaweni yoko. Kwakhona, kwisifundo ndiza kuchaza ukuba usenza njani iscript esitsha kwi /etc/init.d/ ukuze ukwazi ukusilawula kakuhle.

1.Ufakelo:

Siza kuqala ngento yokuqala, faka i-Spawn-FastCGI kunye ne-PHP kwiindawo zethu zokugcina.

Yonke imiyalelo eya kuthi yenziwe iya kwenziwa kunye neemvume zengcambu, nokuba kukubeka isudo ekuqaleni komgca ngamnye okanye ngokungena njengengcambu.

Ukuba kwiseva yakho usebenzisa unikezelo olufana neDebian, Ubuntu okanye ezinye ezivela kwisiphelo sendlela kufuneka ubeke oku kulandelayo kwaye ucinezele faka :

aptitude install spawn-fcgi php5-cgi php5-curl

ukufaneleka akufakwanga ngokungagqibekanga ku-Ubuntu, nangona kunjalo ndicebisa ukuba uyifake kwaye uyisebenzise endaweni yokufumana ngokufanelekileyo, njengoko ubuchule busebenza kakuhle kulawulo lokuxhomekeka kwizihlandlo ezithile

Ngokwam, andikukhuthazi nakuphi na ukuphuma kwe-Debian, nditsho no-Ubuntu kumaseva, kule minyaka idlulileyo amava am ebengonelisekanga kwaphela. Ukhetho lwam lokuqala lwenkqubo yokusebenza kweseva yiDebian, emva koko ndicinga ngeCentOS, ekugqibeleni ezinye ze-BSD

2. Uqwalaselo:

Kwinyathelo langaphambili (xa sifaka i-Nginx) sikhuphele ifayile ebizwa ngokuba yi-nginx-spawn-fastcgi.tar.gz ethi xa uyikhuphile yenze ifolda nginx-spawn-fastcgi ekhayeni lethu, siya kuyikopa kwifayile spawn-fastcgi ukuya /etc/init.d/:

cp ~/nginx-spawn-fastcgi/spawn-fastcgi /etc/init.d/

Kwakhona, sidinga i-php-fastcgi ephunyeziweyo kwi / usr / bin /

cp ~/nginx-spawn-fastcgi/php-fastcgi /usr/bin/

Ukugqibelela, sinefayile esele ilungile eya kusivumela ukuba silawule i-spawn-fastcgi kunye ne-php-fastcgi ephumelelayo, ngoku siza kuqala i-spawn-fastcgi:

/etc/init.d/spawn-fastcgi start

Izakusibonisa into efana nale: i-spawn-fcgi: umntwana uzalwe ngempumelelo: I-PID: 3739

Ngoku siza kuthatha indawo yethu /etc/nginx/sites-available/mywebsite.net file nge ~ / nginx-spawn-fastcgi / mywebsite_plus_php.net

cp ~/nginx-spawn-fastcgi/mywebsite_plus_php.net /etc/nginx/sites-available/mywebsite.net

Ngoba? Ilula, kuba ifayile yethu yangaphambili ye-mywebsite.net ayinayo inkxaso ye-PHP, oko kukuthi, yi-Nginx kuphela, ngelixa ifayile ye-mywebsite_plus_php.net inayo inkxaso ye-PHP, oko kukuthi, i-Nginx + PHP isebenzisa iSpawnFastCGI.

Umahluko phakathi kwezi fayile uliqela, umzekelo:

  • Kumgca 3 ifayile exhasa i-PHP yongezwa index.php
  • Umgca omtsha phantsi kweNombolo 3 oqukethe: fastcgi_index index.php;
  • Imigca emininzi eyahlukeneyo exelela i-Nginx indlela yokwenza i-PHP.
  • โ€ฆ .. Ngamafutshane, nantsi ifoto eya kukunceda wazi umahluko phakathi kwezi fayile zimbini:

Nginx_mysql_spawn-fastcgi_comparing_mywebsite_confs

Ifayile ye-mywebsite_plus_php.net iyi-vhost esebenza njengomzekelo, oko kukuthi, ngamanye amagama, kufuneka siyiguqule kwaye simisele ubumbeko lwethu.

Kufuneka sitshintshe oku kulandelayo:

  • ukufikelela_log (umgca 3): Le iya kuba yindlela yefayile yokungena kule ndawo
  • Impazamo_log (umgca 4): Le iya kuba yindlela yefayile yelog yempazamo kule ndawo
  • server_name (umgca 5): I-URL, ithambeka ebanjwe kulo lawulo, umzekelo, ukuba ibiyi-DesdeLinux iforum ibiya kuba: iforum_yegama leseva.desdelinux.net
  • ingcambu (umgca 6): Indlela eya kwifolda apho zikhona iifayile ze-html, masiyiyeke le / var / www / njengoko izakuba luvavanyo kuphela
Ngokucacileyo kufuneka babonakalise kwiirekhodi zabo ze-DNS zomboneleli wabo wokusingathwa (besebenzisa iCPanel okanye esinye isixhobo) ukuba idomeyini okanye isizinda esichaziweyo kwiserver_name sibekwe kwi-IP yale seva abayilungiselelayo. Oko kukuthi, kwi-DNS apho benza khona ii-subdomains zommandla wabo, kufuneka baxele ukuba i-domain okanye i-subdomain abayibeke kumgca we-5 ikule seva (le seva = idilesi ye-IP yomncedisi ochaphazelekayo)

Silungile, ngoku siza kuqala kwakhona i-Nginx:

/etc/init.d/nginx restart

Ukuqinisekisa ukuba iinkqubo zethu zeNginx ze-PHP ngokufanelekileyo, masikope ifayile phptest.php kwifolda ebanjelweyo, oko kukuthi, leyo iboniswe kumgca we-6 we-mywebsite_plus_php.net ifayile (umzekelo, ingcambu / var / www /), Ukucinga ukuba indawo ibanjwe ngqo kwi / var / www / iya kuba:

cp ~/nginx-spawn-fastcgi/phptest.php /var/www/

Ukucinga ukuba kumgca we-5 we-mywebsite_plus_php.net (Oko kukuthi, umgca wegama lomncedisi) sithe indawo yethu yile www.mysite.net emva koko kufuneka singene ku-www.mysite.net/phptest.php. Ngamanye amagama, umbono kukufikelela kwifayile phptest.php kwisikhangeli sethu kwaye ukuba oku kulandelayo kuyavela emva koko i-Nginx yethu idityaniswe ngokugqibeleleyo ne-PHP:

Nginx_mysql_spawn-ngokukhawulezacgi_tersting_nginx_php

Kwimeko apho oku kungabonakali, oko kukuthi, ukuba isikhangeli sizame ukukhuphela ifayile ye-.php ... oku kuthetha ukuba benze into engalunganga, abayithathi indawo /etc/nginx/sites-available/mywebsite.net nge ~ / nginx-spawn-fastcgi / mywebsite_plus_php.netโ€ฆ ukuba balibale ukuqala kwakhona i-Nginx nge /etc/init.d/nginx ukuqala kwakhona okanye ukuba balibale ukuqala iSpawn-FastCGI nge /etc/init.d/spawn-fastcgi

Ukuza kuthi ga ngoku isifundo sokudibanisa i-Nginx kunye ne-PHP usebenzisa iSpawnFastCGI, sifuna i-MySQL kunye ne-APC kuphela.

Ndiyathemba ukuba uyakufumana oku kunomdla.


Shiya uluvo lwakho

Idilesi yakho ye email aziyi kupapashwa. ezidingekayo ziphawulwe *

*

*

  1. Uxanduva lwedatha: UMiguel รngel Gatรณn
  2. Injongo yedatha: Ulawulo lwe-SPAM, ulawulo lwezimvo.
  3. Umthetho: Imvume yakho
  4. Unxibelelwano lwedatha: Idatha ayizukuhanjiswa kubantu besithathu ngaphandle koxanduva lomthetho.
  5. Ukugcinwa kweenkcukacha
  6. Amalungelo: Ngalo naliphi na ixesha unganciphisa, uphinde uphinde ucime ulwazi lwakho.

      f3niX sitsho

    Ukuba yikota, kutheni umfanekiso usithi 3? uqale ngo 0 Ndiyaqikelela? Iposti ebalaseleyo.

    Phendula nge quote

         I-KZKG ^ iGaara sitsho

      1: Ukunikezelwa
      Okwesibini: Nginx
      Okwesithathu: Nginx + PHP (Spawn_FastCGI)

      ๐Ÿ™‚

      Enkosi ngokufunda ^ _ ^

           Rodrigo sitsho

        kwenzeke ntoni nge part 4 ???
        kunye nolandelayo ?????

      yeyokugqibela sitsho

    Sawubona,

    Iya kuba lukhetho olungcono ukuba endaweni ye-mysql, usebenzise uMariaDB, njengoko kufanele uyazi, le yokugqibela yimfoloko yeyokuqala, kwaye sele kukho intetho yokuba iya kuba yiMysql yexesha elizayo (http://www.genbetadev.com/bases-de-datos/mariadb-sera-el-mysql-del-futuronjengoko iMysql isimahla, ukuya kuthi ga kwinqanaba.

    I-SkySQL, inkampani ebonelela ngeenkonzo ezisuka kulwazi lwasimahla, ezixhasa ngemali iprojekthi kaMariaDB (http://www.genbetadev.com/bases-de-datos/mariadb-y-skysql-unen-fuerzas-para-llevar-a-mariadb-a-lo-mas-alto) kunye noGoogle ofuna ukuyeka ngokuxhomekeke kwi-Mysql, njengoko i-Wikipedia nayo yenzayo, kwaye iyakwenza utshintsho ukusuka kwi-MySQL 5.1 ukuya kwi-MariaDB 10.0 ngoncedo, ngokuchanekileyo, nge-SkySQL, esele ziingcali kweli candelo.

    molo2.

         I-KZKG ^ iGaara sitsho

      Sawubona,

      Ewe kunjalo, ndiyamazi uMariaDB kwaye enyanisweni, sele sithethile ngayo: https://blog.desdelinux.net/tag/mariadb/

      Nangona kunjalo, ngoku ndisebenzisa i-MySQL kuba ndenza ezi tutorials ukusuka kumava athile endinawo xa ndifuduka ndisuka kwiLinux (nazo zonke iinkonzo zayo) ukuya kwezinye iiseva, ngelo xesha sitshintshe itekhnoloji ngokupheleleyo kunye nemisebenzi okanye utshintsho ebendinalo ubuso babungembalwa.
      Funda olu luvo lwam ukusukela ngala mzuzu: https://blog.desdelinux.net/el-blog-desdelinux-abandona-hostgator-y-pasa-a-gnutransfer/comment-page-1/#comment-81291

      Umbono wokugqibela ngu-ewe ngokwenene, fudukela eMariaDB, kodwa andinaxesha lokwenza iimvavanyo ezifanelekileyo relevant

      Enkosi ngokufunda

      Eliotime3000 sitsho

    Olu qeqesho luya kundinceda ukuba ndifake i-zPanel X nge-NGINX ukuze ndingagcwalisi indawo yam xa ufudukela kwi-GNUPanel VPS.

      Ukutsala sitsho

    Isipho seKrisimesi? Ndijonge phambili ukuvuyisana nabo bonke.

         I-KZKG ^ iGaara sitsho

      Enkosi iqabane

      Intsimbi sitsho

    Yongezwe kwiintandokazi!

    Ngendlela, ndinala kuthandabuza kunye nombuzo, ngaba ngenene i-Nginx inentsebenzo engaphezulu kune-Apache?

    Nibuliso!

         I-KZKG ^ iGaara sitsho

      Ewe, i-Apache inokulungiswa kakhulu kodwaโ€ฆ kude kube ngoku, uGoogle yena kwaye phantse sonke siyavuma ukuba i-Nginx isebenzisa i-RAM encinci, ayisebenzi ngokungathethekiyo, nangona ingekho lula kangako xa iqwalaselwa.

      ULuis Morales sitsho

    KZKG elungileyo ^ IGaara ulwazi olugqwesileyo kwabo kuthi banomdla kweli hlabathi, umbuzo, wokuba nini iposti ye-4