×ðÁú¿­Ê±

apacheÖÐcgiĿ¼ÔõôÉèÖÃ

ÒªÔÚ apache ÖÐÉèÖà cgi Ŀ¼£¬ÐèÒªÖ´ÐÐÒÔÏ°취£º½¨Éè cgi Ŀ¼£¬Èç “cgi-bin”£¬²¢ÊÚÓè apache дÈëȨÏÞ¡£ÔÚ apache ÉèÖÃÎļþÖÐÌí¼Ó “scriptalias” Ö¸Áî¿é£¬½« cgi Ŀ¼ӳÉäµ½ “/cgi-bin” url¡£ÖØÆô apache¡£

Apache ÖÐÉèÖà CGI Ŀ¼

CGI£¨Í¨ÓÃÍø¹Ø½Ó¿Ú£©ÊÇÒ»ÖÖÔÊÐí Web ЧÀÍÆ÷ÓëÍⲿ³ÌÐò½»»¥µÄЭÒé¡£ÔÚ Apache Web ЧÀÍÆ÷ÖУ¬CGI Ŀ¼ÊÇ´æ´¢ CGI ¾ç±¾µÄλÖá£

ÉèÖà CGI Ŀ¼µÄ°ì·¨£º

1. ½¨Éè CGI Ŀ¼

ÔÚÎĵµ¸ùĿ¼Öн¨ÉèÒ»¸öÃûΪ “cgi-bin” µÄĿ¼¡£ÕâÊÇ CGI ¾ç±¾µÄ±ê׼λÖ㬵«¿ÉÒÔƾ֤ÐèÒªÃüÃû¡£

2. ÊÚÓèдÈëȨÏÞ

Apache ÐèÒªÄܹ»Ð´Èë CGI Ŀ¼ÒÔ½¨ÉèºÍ¶ÁÈ¡¾ç±¾¡£¸ü¸Ä CGI Ŀ¼µÄȨÏÞ£¬Èà Apache ×é¿Éд£º

sudo chgrp -R www-data cgi-bin
sudo chmod -R g+w cgi-bin

µÇ¼ºó¸´ÖÆ

3. ÉèÖÃ Apache

ÔÚ Apache ÉèÖÃÎļþÖУ¨Í¨³£ÊÇ /etc/apache2/sites-available/000-default.conf£©ÖУ¬ÕÒµ½ “ScriptAlias” Ö¸Áî¿é¡£Ìí¼ÓÒÔÏÂÐУ¬½« CGI Ŀ¼ӳÉäµ½ “/cgi-bin” URL£º

ScriptAlias /cgi-bin/ "/var/www/html/cgi-bin/"

µÇ¼ºó¸´ÖÆ

4. ÖØÆô Apache

Ó¦Óøü¸Äºó£¬ÐèÒªÖØÆô Apache£º

sudo systemctl restart apache2

µÇ¼ºó¸´ÖÆ

ÏÖÔÚ£¬¿ÉÒÔÔÚ “cgi-bin” Ŀ¼Öа²ÅÅ CGI ¾ç±¾£¬²¢´Ó Web ä¯ÀÀÆ÷»á¼ûËüÃÇ¡£Ö»ÐèÔÚ URL ÖÐʹÓà “/cgi-bin/”£¬È»ºóÊǾ籾µÄÃû³Æ£¬¼´¿É¡£

ÀýÈ磬Ҫ»á¼ûÃûΪ “test.cgi” µÄ¾ç±¾£¬¿ÉÒÔʹÓÃÒÔÏ URL£º

http://example.com/cgi-bin/test.cgi

µÇ¼ºó¸´ÖÆ

ÒÔÉϾÍÊÇapacheÖÐcgiĿ¼ÔõôÉèÖõÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

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

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±

18523999891

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

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

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