尊龙凯时人生就是搏

nginx?phpÏîÄ¿Ôõô°²ÅÅ

°²ÅÅ nginx php ÏîÄ¿°ì·¨£º×°Öà nginx¡¢php¡¢mysql£¨¿ÉÑ¡£©¡£½¨Éè nginx ÉèÖÃÎļþ£¬Ö¸¶¨¼àÌý¶Ë¿Ú¡¢Ð§ÀÍÆ÷Ãû³Æ¡¢ÏîÄ¿¸ùĿ¼ºÍ php ´¦Àí³ÌÐò¡£½¨Éè fastcgi ¾ç±¾£¬ÉèÖà php-fpm ´¦Àí php¡£ÆôÓÃÉèÖÃÎļþ£¬½¨Éè·ûºÅÁ´½Ó¡£ÖØÆô nginx¡£×°Öà php-fpm£¬ÉèÖà cgi.fix_pathinfo¡£ÖØÆô php-fpm¡£×°Öà mysql£¨¿ÉÑ¡£©£¬ÉèÖò¢ÉèÖÃÓû§ºÍÃÜÂë¡£²âÊÔ°²ÅÅ£¬»á¼ûÓòÃû²¢ÑéÖ¤ php/mysql ¹¦Ð§¡£

ÔõÑù°²ÅÅ Nginx PHP ÏîÄ¿

°ì·¨

1. ×°ÖÃËùÐèµÄÈí¼þ

Nginx

PHP

MySQL£¨¿ÉÑ¡£©

2. ½¨Éè Nginx ÉèÖÃÎļþ

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

ÔÚ /etc/nginx/sites-available/ Ŀ¼Ï½¨ÉèÒ»¸öÐÂÎļþ£¬ÀýÈç my_site.conf£¬²¢Ìí¼ÓÒÔÏÂÄÚÈÝ£º

server {
    listen 80;
    server_name my_site.com;

    root /path/to/my_site;

    location / {
        try_files $uri $uri/ /index.php;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass 127.0.0.1:9000;
    }
}

µÇ¼ºó¸´ÖÆ

Ìæ»» my_site.com ΪÄãµÄÓòÃû¡£

Ìæ»» /path/to/my_site ΪÏîÄ¿¸ùĿ¼¡£

3. ½¨Éè FastCGI ¾ç±¾

ÔÚ /etc/nginx/snippets/ Ŀ¼Ï½¨ÉèÒ»¸öÐÂÎļþ£¬ÀýÈç fastcgi-php.conf£¬²¢Ìí¼ÓÒÔÏÂÄÚÈÝ£º

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;

µÇ¼ºó¸´ÖÆ

4. ÆôÓÃÉèÖÃÎļþ

ͨ¹ý½¨Éè·ûºÅÁ´½Ó½«ÉèÖÃÎļþÁ´½Óµ½ /etc/nginx/sites-enabled/ Ŀ¼£º

ln -s /etc/nginx/sites-available/my_site.conf /etc/nginx/sites-enabled/my_site.conf

µÇ¼ºó¸´ÖÆ

5. ÖØÆô Nginx

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

sudo systemctl restart nginx

µÇ¼ºó¸´ÖÆ

6. ÉèÖÃ PHP

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

sudo apt-get install php7.4-fpm

µÇ¼ºó¸´ÖÆ

ÐÞ¸Ä /etc/php/7.4/fpm/php.ini Îļþ£¬ÉèÖÃÈçÏ£º

cgi.fix_pathinfo = 0

µÇ¼ºó¸´ÖÆ

ÖØÆô PHP-FPM£º

sudo systemctl restart php7.4-fpm

µÇ¼ºó¸´ÖÆ

7. ×°Öà MySQL£¨¿ÉÑ¡£©

×°Öà MySQL£º

sudo apt-get install mysql-server

µÇ¼ºó¸´ÖÆ

ÉèÖà MySQL ²¢ÉèÖÃÓû§ºÍÃÜÂë¡£

8. ²âÊÔ°²ÅÅ

ÔÚä¯ÀÀÆ÷Öлá¼ûÄãµÄÓòÃû£¨my_site.com£©¡£

È·±£ PHP Ò³ÃæÕý³£ÊÂÇé¡£

ÑéÖ¤ MySQL ÅþÁ¬£¨ÈôÊÇÒÑ×°Öã©¡£

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

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

Ïà¹ØÐÂÎÅ

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

18523999891

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

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

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