上一篇文章分享了siteground退出台灣的訊息,而當時兩年只需要$119美金在今年到期了,然而續約兩年費用高達$479美金,所以直接將客戶的網站搬移到VPS上面,但是使用phpmyadmin匯入資料時出現504 Gateway Timeout的問題,所以經過逐步測試只需要依照以下設定就不會出現504的錯誤了。

我這邊使用的架構是nginx + apache2 + php-fpm
Proxy 伺服器: nginx |
Web 伺服器: apache2 |
Backend 伺服器: php-fpm |
首先 apache2 的部分 apache2 Timeout 更改成 120

接著將 nginx 的 fastcgi_read_timeout 修改成 60s;

最後將php-fpm 設定值做修改即可,但是post_max_size 和 upload_max_filesize 要注意上傳的檔案大小做調整,如果小於上傳檔案一樣會失敗喔!

max_execution_time 300
memory_limit 256M
post_max_size 128M
upload_max_filesize 128M