尊龙凯时人生就是搏

nginxÔõÑùÉèÖÃphp

ÉèÖà nginx ÔËÐÐ php µÄ°ì·¨°üÀ¨£º×°Öà php¡¢×°Öà nginx¡¢±à¼­ nginx Ö÷ÉèÖÃÎļþÌí¼Ó php ÉèÖᢽ¨Éè php Îļþ¡¢ÖØÆô nginx¡¢²âÊÔ php£¬Àֳɺó»áÏÔʾ “php is working!” ÐÂÎÅ ¡£

ÔõÑùÉèÖÃ Nginx ÒÔÔËÐÐ PHP

°ì·¨ 1£º×°Öà PHP

ÔÚÄãµÄЧÀÍÆ÷ÉÏ×°Öà PHP£¬ÏÂÁîÈçÏ£º

sudo apt-get install php7.4-fpm

µÇ¼ºó¸´ÖÆ

°ì·¨ 2£º×°Öà Nginx

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

ÈôÊÇÉÐδװÖà Nginx£¬ÇëʹÓÃÒÔÏÂÏÂÁ

sudo apt-get install nginx

µÇ¼ºó¸´ÖÆ

°ì·¨ 3£ºÉèÖà Nginx

±à¼­ Nginx µÄÖ÷ÉèÖÃÎļþ /etc/nginx/nginx.conf£¬Ìí¼ÓÒÔÏÂÉèÖÿ飺

server {
    listen 80;
    server_name example.com;
    root /var/www/html;

    location ~ \.php$ {
        fastcgi_pass unix:/run/php/php7.4-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}

µÇ¼ºó¸´ÖÆ

°ì·¨ 4£º½¨Éè PHP Îļþ

ÔÚ Nginx µÄ¸ùĿ¼ (/var/www/html) ÖУ¬½¨ÉèÒ»¸ö PHP Îļþ£¬ÀýÈç index.php£º

<?php echo "PHP is working!";
?>

µÇ¼ºó¸´ÖÆ

°ì·¨ 5£ºÖØÆô Nginx

ÖØÆô Nginx ÒÔÓ¦Óøü¸Ä£º

sudo systemctl restart nginx

µÇ¼ºó¸´ÖÆ

°ì·¨ 6£º²âÊÔ PHP

»á¼ûÄãµÄÍøÕ¾£¨http://example.com£©£¬ÄãÓ¦¸Ã¿´µ½ “PHP is working!” ÐÂÎÅ£¬Åú×¢ PHP ÒÑÀÖ³ÉÓë Nginx ¼¯³É ¡£

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

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

Ïà¹ØÐÂÎÅ

ÁªÏµ尊龙凯时人生就是搏

18523999891

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

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

QR code
sitemap¡¢ÍøÕ¾µØͼ