×ðÁú¿­Ê±¹ÙÍøµÇ¼

nginxÔõôÆô¶¯php

ÔõÑùÔÚ nginx ÖÐÆô¶¯ php£¿ÔÚ nginx ÖÐÆô¶¯ php µÄ°ì·¨£º1. ×°Öà php£»2. ×°Öà php-fpm£»3. ÉèÖà nginx ÐéÄâÖ÷»úÒÔʹÓà php-fpm¡£

ÔõÑùÆô¶¯ nginx ÖÐµÄ PHP

¼òÒª»Ø¸²£º

ÔÚ nginx ÖÐÆô¶¯ PHP µÄ°ì·¨£º

×°ÖÃ PHP

×°Öà PHP-FPM£¨FastCGI Àú³ÌÖÎÀíÆ÷£©

ÉèÖà nginx ÐéÄâÖ÷»úÒÔʹÓà PHP-FPM

Ïêϸ˵Ã÷£º

Á¬Ã¦Ñ§Ï°¡°PHPÃâ·ÑѧϰÌõ¼Ç£¨ÉîÈ룩¡±£»

1. ×°Öà PHP£º

ʹÓÃÒÔÏÂÏÂÁî×°Öà PHP£º

sudo apt-get update
sudo apt-get install php7.4-fpm

µÇ¼ºó¸´ÖÆ

2. ×°Öà PHP-FPM£º

ʹÓÃÒÔÏÂÏÂÁî×°Öà PHP-FPM£º

sudo apt-get install php7.4-fpm

µÇ¼ºó¸´ÖÆ

3. ÉèÖà nginx ÐéÄâÖ÷»ú£º

·­¿ªÐéÄâÖ÷»úÉèÖÃÎļþ£¨ÀýÈ磬/etc/nginx/sites-available/example.com£©£¬²¢Ìí¼ÓÒÔÏÂÉèÖãº

location ~ \.php$ {
    try_files $uri =404;
    fastcgi_pass unix:/run/php/php7.4-fpm.sock;
    fastcgi_index index.php;
    include fastcgi_params;
}

µÇ¼ºó¸´ÖÆ

ÆäÖУº

location ~ \.php$£ºÆ¥ÅäËùÓÐÒÔ .php ×îºóµÄÎļþ

try_files $uri =404;£ºÈôÊÇÎļþ²»±£´æ£¬Ôò·µ»Ø 404 ¹ýʧ

fastcgi_pass unix:/run/php/php7.4-fpm.sock;£º½«ÇëÇóת·¢µ½ PHP-FPM Ì×½Ó×Ö

fastcgi_index index.php;£ºÖ¸¶¨Ä¬ÈÏË÷ÒýÎļþ

include fastcgi_params;£º°üÀ¨ FastCGI ²ÎÊý

ÉúÑIJ¢Í˳öÉèÖÃÎļþ¡£

ÖØÆô nginx£º

sudo systemctl restart nginx

µÇ¼ºó¸´ÖÆ

PHP ÏÖÔÚÓ¦¸ÃÔÚ nginx ÖÐÆô¶¯²¢ÔËÐС£

ÒÔÉϾÍÊÇnginxÔõôÆô¶¯phpµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±¹ÙÍøµÇ¼ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎ壬9:30-18:30£¬½ÚãåÈÕÐÝÏ¢

QR code
ÍøÕ¾µØͼ