尊龙凯时人生就是博

nginxÔõÑù¿ªÆôα¾²Ì¬

ÔõÑù¿ªÆô nginx α¾²Ì¬£¿ÆôÓà multiviews Ä£¿é£¬ÔÊÐíЧÀÍÆ÷ƾ֤À©Õ¹ÃûËÑË÷Îļþ¡£Ìí¼Óα¾²Ì¬¹æÔò£¬½« .php url ÖØдµ½Æ¥ÅäµÄ php Îļþ¡£È·±£ web ЧÀÍÆ÷Àú³ÌÓÐȨ»á¼û php Îļþ¡£ÖØÆô nginx ÒÔÓ¦Óøü¸Ä£¬´Ó¶øʵÏÖ url Ó³Éäµ½Îļþ·¾¶µÄ¹¦Ð§¡£

ÔõÑù¿ªÆô Nginx α¾²Ì¬

Nginx α¾²Ì¬ÊÇÒ»ÖÖÉèÖÃÒªÁ죬ÔÊÐíЧÀÍÆ÷½« URL Ó³Éäµ½ÄÚ²¿Îļþϵͳ·¾¶£¬´Ó¶øʵÏÖÀàËÆÓÚ Apache .htaccess ÖÐ Rewrite Ä£¿éµÄ¹¦Ð§¡£¿ªÆô Nginx α¾²Ì¬ºÜ¼òÆÓ£¬Ö»ÐèÒÔÏ°취£º

1. ÆôÓÃ MultiViews

Ê×ÏÈ£¬ÔÚ Nginx ÉèÖÃÎļþÖÐÆôÓà MultiViews Ä£¿é£º

server {
    ...

    location / {
        autoindex on;
        multiviews on;
    }

    ...
}

µÇ¼ºó¸´ÖÆ

2. ÉèÖÃα¾²Ì¬¹æÔò

ÔÚÏàͬµÄλÖÿéÖУ¬Ìí¼ÓÒÔÏÂα¾²Ì¬¹æÔò£º

location ~ \.php$ {
    try_files $uri =404;
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    include        fastcgi_params;
}

µÇ¼ºó¸´ÖÆ

3. ÐÞ¸ÄÎļþȨÏÞ

È·±£ Web ЧÀÍÆ÷Àú³ÌÓÐȨ»á¼ûÄúµÄ PHP Îļþ¡£Îª´Ë£¬ÇëʹÓÃÒÔÏÂÏÂÁ

sudo chmod 644 /var/www/html/*.php

µÇ¼ºó¸´ÖÆ

4. ÖØÆô Nginx

×îºó£¬ÖØÆô Nginx ÒÔÓ¦Óøü¸Ä£º

sudo systemctl restart nginx

µÇ¼ºó¸´ÖÆ

Ô­Àí˵Ã÷£º

ͨ¹ýÆôÓà MultiViews Ä£¿é£¬Nginx ÔÊÐíЧÀÍÆ÷ƾ֤ÇëÇóµÄÎļþÀ©Õ¹ÃûËÑË÷¶à¸öÎļþ¡£Î±¾²Ì¬¹æÔò½«ËùÓÐÒÔ .php ×îºóµÄ URL ÖØдµ½Óë֮ƥÅäµÄ PHP Îļþ¡£µ±ÇëÇó´¦Àíʱ£¬Nginx ½« PHP Îļþת´ï¸ø FastCGI ´¦Àí³ÌÐò£¬FastCGI ´¦Àí³ÌÐòÈ»ºóÖ´ÐÐ PHP ´úÂë²¢ÌìÉúÏìÓ¦¡£

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

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

Ïà¹ØÐÂÎÅ

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

18523999891

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

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

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