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

CentOS 7ÉϴwebЧÀÍÆ÷µÄ³£¼û¹ýʧ¼°½â¾öÒªÁì

CentOS 7ÉϴwebЧÀÍÆ÷µÄ³£¼û¹ýʧ¼°½â¾öÒªÁì

ÔڴwebЧÀÍÆ÷µÄÀú³ÌÖУ¬³£³£»áÓöµ½Ò»Ð©¹ýʧºÍÎÊÌâ¡£±¾ÎĽ«ÏÈÈݳ£¼ûµÄ¹ýʧÒÔ¼°½â¾öÒªÁ죬²¢ÌṩÏìÓ¦µÄ´úÂëʾÀý¡£Ï£ÍûÄܹ»×ÊÖú¶ÁÕßÔÚCentOS 7ÉÏ˳Ëì´î½¨ºÍÔËÐÐwebЧÀÍÆ÷¡£

¹ýʧ1£ºÎÞ·¨Æô¶¯ApacheЧÀÍ

½â¾öÒªÁ죺

È·±£ApacheÒѾ­×¼È·×°Ö᣿ÉÒÔʹÓÃÒÔÏÂÏÂÁî¾ÙÐÐ×°ÖÃ:

sudo yum install httpd

µÇ¼ºó¸´ÖÆ

Æô¶¯ApacheЧÀÍ£º

sudo systemctl start httpd

µÇ¼ºó¸´ÖÆ

¼ì²éApacheÊÇ·ñÒѾ­ÀÖ³ÉÆô¶¯£º

sudo systemctl status httpd

µÇ¼ºó¸´ÖÆ

ÈôÊÇApacheÆô¶¯Ê§°Ü£¬¿ÉÒÔ¼ì²éÈÕÖ¾Îļþ¾ÙÐÐÅŲ飬²¢Æ¾Ö¤Ïêϸ¹ýʧÐÅÏ¢¾ÙÐÐÐÞ¸´¡£

¹ýʧ2£º»á¼ûÍøվʱ·ºÆð”403 Forbidden”¹ýʧ

½â¾öÒªÁ죺

¼ì²éÍøÕ¾¸ùĿ¼£¨Í¨³£Îª/var/www/html£©µÄȨÏÞÊÇ·ñ׼ȷÉèÖ᣿ÉʹÓÃÒÔÏÂÏÂÁîÐÞ¸ÄȨÏÞ£º

sudo chmod -R 755 /var/www/html

µÇ¼ºó¸´ÖÆ

¼ì²éApacheÉèÖÃÎļþÖеÄȨÏÞÉèÖᣱ༭ÉèÖÃÎļþ£¨Í¨³£Îª/etc/httpd/conf/httpd.conf£©£¬ÕÒµ½ÒÔ϶ÎÂ䲢ȷ±£AllowOverrideºÍRequire¾ùÉèÖÃΪ”all”£º

<Directory "/var/www/html">
 AllowOverride all
 Require all granted
</Directory>

µÇ¼ºó¸´ÖÆ

ÖØÐÂÆô¶¯ApacheЧÀÍ£º

sudo systemctl restart httpd

µÇ¼ºó¸´ÖÆ

¹ýʧ3£º»á¼ûÍøվʱ·ºÆð”500 Internal Server Error”¹ýʧ

½â¾öÒªÁ죺

¼ì²éÍøÕ¾´úÂëÖÐÊÇ·ñ±£´æÓï·¨¹ýʧ¡£¿ÉÒÔʹÓÃÒÔÏÂÏÂÁîÀ´¼ì²éPHP´úÂëµÄÓï·¨ÊÇ·ñ׼ȷ£º

php -l /path/to/your/code.php

µÇ¼ºó¸´ÖÆ

¼ì²éApacheÉèÖÃÎļþÖеĹýʧÈÕ־·¾¶¡£Ä¬ÈÏÇéÐÎÏ£¬¹ýʧÈÕ־·¾¶Îª/var/log/httpd/error_log¡£¿ÉÒÔʹÓÃÒÔÏÂÏÂÁîÉó²é¹ýʧÈÕÖ¾£º

tail -f /var/log/httpd/error_log

µÇ¼ºó¸´ÖÆ

ƾ֤¹ýʧÈÕÖ¾ÖеÄÏêϸ¹ýʧÐÅÏ¢¾ÙÐÐÐÞ¸´¡£

ÒÔÉÏÊÇһЩÔڴwebЧÀÍÆ÷Àú³ÌÖг£¼ûµÄ¹ýʧ¼°½â¾öÒªÁ졣ϣÍûÕâЩ½â¾ö¼Æ»®Äܹ»×ÊÖú¶ÁÕß½â¾öÎÊÌ⣬²¢Ë³ËìÍê³É×Ô¼ºµÄwebЧÀÍÆ÷´î½¨ÊÂÇé¡£ÔÚ½â¾öÎÊÌâʱ£¬¿Éƾ֤Ïêϸ¹ýʧÐÅÏ¢¾ÙÐÐÅŲ飬Ҳ¿É²Î¿¼±¾ÎÄÌṩµÄ½â¾öÒªÁìºÍ´úÂëʾÀý¾ÙÐÐÐÞ¸´¡£×£´î½¨Ë³Ë죡

ÒÔÉϾÍÊÇCentOS 7ÉϴwebЧÀÍÆ÷µÄ³£¼û¹ýʧ¼°½â¾öÒªÁìµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

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

Ïà¹ØÐÂÎÅ

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

18523999891

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

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

QR code
ÍøÕ¾µØͼ