502 bad gateway這個問題很多朋友一看就以為是nginx或apache的問題,其實不然了,除了它們兩會出現這個問題之外還有像php模塊也會導致此問題的出現了,下面一起來看看吧.
502 bad gateway不一定全是nginx,apache之類引起的,也有可能是由其他模塊引起的,例如:php
1,查看php-fpm和nginx的log
- # vim /var/log/nginx/error.log
- recv() failed (104: Connection reset by peer) while reading response header from upstream //開源軟件:Vevb.com
- # vim /var/log/php-fpm/error.log
- WARNING: [pool www] child 29522 exited on signal 11 (SIGSEGV - core dumped) after 2165.472759 seconds from start
2,由php的eaccelerator導致502 bad gateway錯誤
我根據上面的二個錯誤,在網上找方法大部分都說是由nginx或者apache引起的,最近并沒有動nginx的配置,不可能好好的就不行了,當看到有說php擴展apc,有可能會引起502 bad gateway時,因為eaccelerator根apc差不多,猜想會不會是eaccelerator引起502呢?
- # mv /etc/php.d/eaccelerator.ini{,bak}
- # /etc/init.d/php-fpm restart
重啟后問題解決,開始的時候,我以為是cache目錄和log目錄的權限導致502的,就算改了所屬用戶,并且在加上777權限,也還是502錯誤.
新聞熱點
疑難解答