Sida loo rakibo adeege shabakad leh Nginx + MySQL + PHP5 + APC + Spawn_FastCGI [Qaybta 4aad: Nginx + PHP oo leh SpawnFastCGI]

Muddo ka hor Waxaan kaaga sheekeeyay taxanahan casharrada ah, oo ku saabsan sida loo rakibo loona dhigo serverka dalab badan oo martigelin ah. Maqaalkani wuxuu ku saabsan yahay rakibidda iyo qaabeynta Nginx + PHP con SpawnFastCGI:

Cafimat FicanCGI:

Tan waxaa la dhihi karaa waa waxa isku xiraya Nginx iyo PHP, taasi waa, xitaa hadii ay wataan xirmada PHP5 hadii aysan haysan Spawn_FastCGI oo la rakibo lana fuliyo marka ay ka furaan goob PHP ah biraawsarka ayaa soo dejinaya feylka, ma sameyn doono tus wax kasta oo .php-ka la qorsheeyay maxaa yeelay adeegu ma yaqaanno sida loo farsameeyo faylasha .php, taasi waa sababta ay muhiim u tahay in la rakibo loona habeeyo Spawn_FastCGI.

Haddii aan adeegsanay Apache waxay noqon laheyd wax fudud sida rakibida xirmada libapache2-mod-php5, laakiin maadaama aan isticmaalno Nginx waa inaan ku rakibaa xirmada spawn-fcgi halkii. Sidoo kale, casharka waxaan ku sharixi doonaa sida loogu sameeyo qoraal bilow ah iyada oo ah /etc/init.d/ si aad ugu maamuli karto si raaxo leh.

1. Rakibaadda:

Waxaan ku bilaabi doonnaa waxa ugu horeeya, ka soo rakibo Spawn-FastCGI iyo PHP keydkeena.

Dhamaan amarrada la fulinayo waxaa lagu fuliyaa rukhsad rujin, ama adoo gelinaya sudo bilowga sadar kasta ama adoo galaya sida xididka

Haddii aad ku jirto server-kaaga waxaad isticmaashaa qaybinta sida Debian, Ubuntu ama xoogaa wax soo saar ah oo ku yaal terminaalka waa inaad dhigtaa waxyaabaha soo socda oo aad riixdaa Ku qor :

aptitude install spawn-fcgi php5-cgi php5-curl

Aptitude kumbuyuutar ahaan kuma rakibna Ubuntu, si kastaba ha noqotee waxaan kugula talinayaa inaad rakibatid oo aad u isticmaashid halkii aad ka heli lahayd, sababtoo ah caqligu wuxuu si fiican u maareeyaa ku tiirsanaanta mararka qaarkood

Shakhsiyan, kugula talin maayo wax ka soo baxa Debian, xitaa Ubuntu ma ahan server, sanadihii la soo dhaafay khibradeyda si buuxda uma qancin. Xulashadayda koowaad ee nidaamka hawlgalka adeegga waa Debian, markaa waxaan ka fikiri lahaa CentOS, ugu dambeyn qaar BSD ah

2. Qaabeynta:

Tallaabadii hore (markii aan rakibnay Nginx) waxaan kala soo baxnay feyl la yiraahdo nginx-spawn-fastcgi.tar.gz in markii aan furayay ay abuurtay faylka nginx-spawn-fastcgi ee gurigeenna, waxaan ka soo min guurin doonnaa faylka. spawn-fastcgi ilaa /etc/init.d/:

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

Sidoo kale, waxaan u baahanahay php-fastcgi oo lagu fulin karo / usr / bin /

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

Wanaagsan, waxaan diyaar u nahay feylka noo ogolaanaya inaan xakameyno spawn-fastcgi iyo waliba php-fastcgi fulin karo, hada waxaan bilaabi doonnaa spawn-fastcgi:

/etc/init.d/spawn-fastcgi start

Waxay na tusi doontaa wax sida: spawn-fcgi: cunug si guul leh ayuu u dhashay: PID: 3739

Hadda waxaan ku beddeleynaa faylkayaga /etc/nginx/sites-available/mywebsite.net feylkeena oo ah ~ / nginx-spawn-fastcgi / mywebsite_plus_php.net

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

Sababta Fudud, maxaa yeelay feylkeenii hore ee mywebsite.net ma lahan taageero PHP, taasi waa, waa Nginx kaliya, halka feylka mywebsite_plus_php.net uu leeyahay taageero PHP, taasi waa, Nginx + PHP adoo adeegsanaya SpawnFastCGI.

Farqiga u dhexeeya faylalkaani waa dhowr, tusaale ahaan:

  • Sadarka 3 feylka taageera PHP ayaa lagu daray index.php
  • Khadad cusub oo ka hooseeya No.3 oo ka kooban: fastcgi_index index.php;
  • Dhowr khadad oo kale oo cusub oo u sheegaya Nginx sida loo farsameeyo PHP.
  • Marka la soo koobo, waa kan sawir kaa caawin doona inaad ogaato faraqa u dhexeeya labada faylal:

nginx_mysql_spawn-fastcgi_comparing_mywebsite_confs

 

Faylka mywebsite_plus_php.net waa vhost u adeega tusaale ahaan, taasi waa, iyo si kale haddii loo dhigo, waa inaan wax ka bedelno oo aan dhisno qaabeynteena.

Waa inaan bedelnaa waxyaabaha soo socda:

  • access_log (sadarka 3): Tani waxay noqon doontaa wadada feylka gelitaanka ee boggan
  • error_log (khadka 4): Tani waxay noqon doontaa wadada feylka qaladka ee boggan
  • server_name (sadar 5): URL-ka, domain-ka lagu martigaliyo galkaas, tusaale ahaan, haddii uu ahaan lahaa bogga FromLinux wuxuu ahaan lahaa: server_name forum.fromlinux.net
  • xididka (khadka 6): Jidka loo maro galka ay ku yaalliin faylasha html, aynu ku dhaafno tan / var / www / maadaama ay tahay uun imtixaan
Sida iska cad waa inay ku muujiyaan diiwaanka DNS ee bixiyaha martigelinaya (iyagoo isticmaalaya CPanel ama qalab kale) oo ah in domain ama subdomain lagu dhawaaqay server_name uu ku yaal IP-ka serverkan ay iyagu isku habeeyaan. Taasi waa, DNS meesha ay ku abuuraan subdomains-ka maamulkooda, waa inay caddeeyaan in bogga ama subdomain-ka ay geliyeen safka 5 ay ku yaalliin server-kan (server-kan = cinwaanka IP-ga ee server-ka laga hadlayo)

Diyaar, hadda waxaan dib u bilaabi doonnaa Nginx:

/etc/init.d/nginx restart

Si loo hubiyo in Nginx-kayagu u shaqeynayo PHP si sax ah, aan nuqul ka dhigno feylka phptest.php galka la martigeliyay, taas oo ah, midka lagu muujiyey safka No.6 ee feylka mywebsite_plus_php.net (tusaale ahaan, root / var / www /), haddii loo maleeyo in barta toos u martigelisay / var / www / noqonayso:

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

Haddii aan u malayno in safka 5-aad ee boggayaga internet-ka ee loo yaqaan 'mywebsite_plus_php.net' (taasi waa, khadka loo yaqaan 'server_name line') waxaan dhahnay in boggayagu yahay www.mysite.net markaa waa inaan galnaa www.mysite.net/phptest.php. Si kale haddii loo dhigo, fikraddu waa in laga helo feylka phptest.php oo laga helo biraawsarkayaga oo haddii waxyaabaha soo socdaa u muuqdaan markaa Nginx-keena ayaa si dhammaystiran ugu xidhan PHP:

nginx_mysql_spawn-fastcgi_tersting_nginx_php

 

Haddii aysan taasi muuqan, taasi waa, in biraawsarku isku dayo inuu soo dejiyo faylka .php ... tani waxay ka dhigan tahay inay khalad sameeyeen, oo aysan ku beddelin /etc/nginx/sites-available/mywebsite.net ~ / nginx-spawn-fastcgi / mywebsite_plus_php.net… inaad ilowday inaad dib u bilawdid Nginx oo ay weheliso /etc/init.d/nginx dib u bilaw ama aad ilawday inaad ku bilawdo Spawn-FastCGI /etc/init.d/spawn-fastcgi start

Ilaa hadda casharka isku xirka Nginx iyo PHP adoo adeegsanaya SpawnFastCGI, waxaan kaliya u baahanahay MySQL iyo APC 🙂

Waxaan rajeynayaa inay tani adiga xiiso kuu leedahay.


Nuxurka maqaalka wuxuu u hogaansamayaa mabaadi'deena anshaxa tifaftirka. Si aad u soo sheegto khalad guji Halkan.

11 faallooyin, ka tag taada

Ka tag faalladaada

cinwaanka email aan la daabacin doonaa.

*

*

  1. Masuul ka ah xogta: Miguel Ángel Gatón
  2. Ujeedada xogta: Xakamaynta SPAM, maaraynta faallooyinka.
  3. Sharci: Oggolaanshahaaga
  4. Isgaarsiinta xogta: Xogta looma gudbin doono dhinacyada saddexaad marka laga reebo waajibaadka sharciga ah.
  5. Kaydinta xogta: Macluumaadka ay martigelisay Shabakadaha Occentus (EU)
  6. Xuquuqda: Waqti kasta oo aad xadidi karto, soo ceshan karto oo tirtiri karto macluumaadkaaga.

  1.   F3niX dijo

    Hadday rubuc tahay, muxuu sawirku u leeyahay 3? bilaabay 0 waxaan filayaa? post fiican.

    Salaan

    1.    KZKG ^ Gaara dijo

      1aad: Soo bandhigid
      Ta 2aad: Nginx
      3aad: Nginx + PHP (Spawn_FastCGI)

      🙂

      Waad ku mahadsantahay aqrinta ^ _ ^

      1.    Rodrigo dijo

        maxaa ku dhacay qaybtii 4aad ???
        iyo tan xigta ?????

  2.   rpyanm dijo

    Hello

    Waxay noqon laheyd ikhtiyaar wanaagsan halkii aad mysql ahaan laheyd, aad u adeegsan laheyd MariaDB, sidaad u ogaan laheyd kan dambe inuu yahay fargeeto kan ugu horeysa, waxaana horeyba u jiray hadal ah inuu noqon doono Mysql-ka mustaqbalka (http://www.genbetadev.com/bases-de-datos/mariadb-sera-el-mysql-del-futuro) maadaama Mysql uu xor yahay, illaa heer.

    SkySQL, waa shirkad bixisa adeegyo laga helo keydadka macluumaadka bilaashka ah, waxayna dhaqaale ahaan taageertay mashruuca MariaDBhttp://www.genbetadev.com/bases-de-datos/mariadb-y-skysql-unen-fuerzas-para-llevar-a-mariadb-a-lo-mas-alto) iyo Google oo doonaya inay joojiyaan iyadoo kuxiran Mysql, sida Wikipedia oo kale ay sameysay, waxayna ka gudbi doontaa MySQL 5.1 oo loo wareejin doonaa MariaDB 10.0 iyadoo laga caawinayo, si hufan, SkySQL, oo ​​horeyba khuburo ugu ahaa arimahan.

    Salu2.

    1.    KZKG ^ Gaara dijo

      Hello,

      Haa dabcan, waan ogahay MariaDB runtiina, horey ayaan uga hadalnay: https://blog.desdelinux.net/tag/mariadb/

      Si kastaba ha noqotee, hadda waxaan isticmaalayaa MySQL maxaa yeelay waxaan ka shaqeeyaa casharradan khibradda gaarka ah ee aan lahaa markii aan ka haajirayay Linux (adeegyadeeda oo dhan) una wareegaayey server-yo kale, wakhtigaas waxaan beddelnay tiknoolajiyadda gebi ahaanba iyo howlaha ama isbeddelada ay ahayd inaan ku sameeyo wejigu ma yareyn.
      Akhriso faallooyinkaan aniga ah daqiiqadaas: https://blog.desdelinux.net/el-blog-desdelinux-abandona-hostgator-y-pasa-a-gnutransfer/comment-page-1/#comment-81291

      Fikradda ugu dambeysa waa haa runtii, u haajir MariaDB, laakiin ma aanan helin waqti aan ku sameeyo tijaabooyinka ku habboon 🙂

      Waad ku mahadsantahay aqrintaada

  3.   Waqti dheer 3000 dijo

    Casharradan ayaa iga caawin doonta inaan ku rakibo zPanel X oo leh 'NGINX' si aanan ugu qancin boggeyga markii aan u guurayo GNUPanel VPS.

  4.   Dragnell dijo

    Hadiyadda kirismaska? Waxaan sugayay hambalyo dhammaan.

    1.    KZKG ^ Gaara dijo

      Mahadsanid lamaane 😀

  5.   St0rmt4il dijo

    Lagu daray kuwa ugu cadcad!

    By habka, waxaan qabaa shaki iyo su'aal this, Nginx dhab ahaantii wuxuu leeyahay waxqabad ka badan kan Apache?

    Waad ku mahadsan tahay!

    1.    KZKG ^ Gaara dijo

      Hagaag, Apache wax badan ayaa lagafiican karaa laakiin… ilaa hada, Google iyo dhamaanteenba waxaan isku raacsanahay in Nginx uu isticmaalo wax aad uyar oo RAM ah, wuxuu leeyahay waxqabad aan laga fiirsan, inkasta oo aysan aheyn mid si fudud u fudud marka la qaabeynayo.

  6.   louis moral dijo

    Wanaagsan KZKG ^ Gaara macluumaad aad u fiican oo loogu talagalay kuwa naga mid ah ee daneynaya adduunkan, su'aal, goorta boostada 4aad 😀

bool (run)