解決,請求過大導致 The request record is too big
解決,請求過大導致 The request record is too big
Nignx & PHP-FPM 架構中,發送單一請求若header傳輸量過大,就會爆出 request record is too big 的錯誤,
可以檢查是否直接透過http params 方式來夾帶參數
當參數過大,就會導致內容無法送達而爆出錯誤。
Continue ReadingMarketing, SEO, Web trends, Programming tutorial, Web design, and Life event...
Nignx & PHP-FPM 架構中,發送單一請求若header傳輸量過大,就會爆出 request record is too big 的錯誤,
可以檢查是否直接透過http params 方式來夾帶參數
當參數過大,就會導致內容無法送達而爆出錯誤。
Continue Reading使用 Guzzle 只能透過 POST 方式來傳遞 application/x-www-form-urlencoded form params
( 官方原文:form_params - Used to send an application/x-www-form-urlencoded POST request. )
若使用 PUT, DELTE 則需要改用 body 或者 json 格式傳輸,例如:
Continue Reading這裏說明 npm global 安裝完畢出現 command not found 解決方式,以 vue-cli 安裝為例
安裝 vue-cli 流程發生無法從環境變數中直接使用 vue 指令,出現 command not found 或者 sh: vue-cli-service: command not found 該如何解決:
在新主機安裝 vue-cli 之後
npm install -g @vue/cli
在執行版版檢查時,發生 vue: command not found
# vue --version
-ash: vue: command not found
解決這問題的方式如下:
Continue Reading當 Volumes 容量不足時,可以直接在 Volumes 容量,
調整容量後,實際容量還不會增加,這時還必須再進行系統指令進行擴容
這裡分別說明針對分割區 及 檔案系統 進行擴容的方式:
提醒,再增加容量前,建議先建立快照
在開始前,先透過 lsblk查看目前磁碟區,以及確認你要擴充的磁碟
接著檢查你磁碟的類型,例如:
sudo file -s /dev/xvda
接著,請針對磁碟的類型,進行對應的擴容方式
以下說明三種類型的擴充方法:
Continue ReadingHTTPS 超文本傳輸安全協定(HyperText Transfer Protocol Secure)是一種讓HTTP傳輸過程可透過 SSL/TLS 來對封包進行加密的安全傳輸協定,預設使用的是 443 port。
也就是在不安全的傳輸,額外建立安全機制。
在敏感及機密性的網路傳輸,都必須使用 HTTPS 避免身份及隱私被劫持。
Continue Reading在 Linux 維護專案時,有時遇到檔案權限問題,這裡說明如何一次處理的方式
例如,要將 /var/www/ 底下所有檔案及資料夾進行權限變更,作法如下:
一次修改資料夾權限為 755
find /var/www/ -type d -exec chmod 2775 {} \;
一次修改檔案權限為 644
find /var/www/ -type f -exec chmod 0664 {} \;
Continue Reading
Interface 類別主要用於定義一些關鍵字及 public 的抽象方法,不需要定義方法的 body 及參數。
<?php
interface Logger{
public function excute();
}
首先,針對未使用 Interface 的情況進行說明,
如果在大型專案只有使用 Class,例如以下範例,當我們要切換不同的 Log 方式時,就要透過手動方式在多處 constructor 處進行 hard-coded 變更,例如
<?php
class LogToDatabase {
public function execute($message)
{
var_dump('log the message to a database :'.$message);
}
}
class LogToFile {
public function execute($message)
{
var_dump('log the message to a file :'.$message);
}
}
class UsersController {
protected $logger;
public function __construct(LogToFile $logger)
{
$this->logger = $logger;
}
public function show()
{
$user = 'nahid';
$this->logger->execute($user);
}
}
$controller = new UsersController(new LogToFile);
$controller->show();
例如,目前在 UsersController 使用 LogToFile,
Continue Reading在 NAS 建立對外網站,通常會使用 proxy 方式來做轉導
本篇會預設你已經對於 Docker, NAS 有基礎的了解,並且知道如何在 NAS 新增 Docker 服務,以及設定網域指向的知識。
Continue ReadingSynology NAS 預設都會使用 80 port,且會轉導到 500x port
這裡將說明如何變更 80 port 。
變更 Synology 預設 80 port 的方式很簡單
首先 ssh 登入到 NAS
接著,修改 nginx 設定
vi /usr/syno/share/nginx/WWWService.mustache
vi /usr/syno/share/nginx/DSM.mustache
vi /usr/syno/share/nginx/server.mustache
接著 重啟服務
synoservicecfg --restart nginx
Continue Reading
在 GitLab 強制 push 到 master 時,
git push -f origin master
出現錯誤訊息:
remote: GitLab: You are not allowed to force push code to a protected branch on this project.
Continue ReadingLazyCollection 可以調用 Memy() ,能記取計算過的值,在運算大數據過程,能避免大量消耗內存的狀況。
範例:
<?php ...
$users = User::cursor()->remember();
// No query has been executed yet.
$users->take(5)->all();
// The query has been executed, and the first 5 users have been streamed from the DB.
$users->take(20)->all();
// The first 5 users came from the cache. The rest continued the stream from the DB.
afterLast 可以取得字串中,“最後一個”指定字符 之後的文字
beforeLast 可以取得字串中,“最後一個”指定字符 之前的文字
Continue Reading這裡記錄 Vue 初始設定會用到的一些基本設定
包括語法亮潔以及代碼自動風格化設定.
另外會提到如何在 VSCode settings.json 設定儲存自動將語法進行整理,風格化
Continue Reading在Terminal 使用vim 之後,若出現複製貼上會出現 00~, 01~ 或 0~, 1~
原因可能是你的Terminal 正處於bracketed黏貼模式( bracketed paste mode)
在一些尚未更新或較為老舊的terminal可能會出現00~ 01~ 的字段
解決方式是直接透過以下語法將 bracketed paste mode 關閉
printf "\e[?2004l"
ElasticSearch 可以把數據透過 Index 索引的方式來儲存。
通常,一台機器可以運行多個 ElasticSearch,每一個都視為一個節點(Node)。
在 ElasticSearch 主要結構與關聯資料庫做對比的話,關係大致如下:
| ElasticSearch | 關聯資料庫 |
|---|---|
| 索引(Index) | 資料庫(Database) |
| 類型(Type) | 資料表(Table) |
| 文檔(Document) | 數據行紀錄(Row) |
| 域(Field) | 數據列(Column) |
| 參數映射(Mapping) | 模式(Schema) |
在內部測試機測試瀏覽器錄音功能需要用到 Https,在這裡記錄如何在 localhost 環境安裝憑證及設定 https
Continue Reading透過 GCP Storage 儲存檔案,在前端呈現時出現了 CORS 問題
錯誤訊息: Access to fetch at url from origin url has been blocked by CORS policy: NO ‘Access-Control-Allow-Origin’ header is present on the requested resource. …
原因是在於,GCP Storage 為了預防惡意取用而預設不開啟。
這裡紀錄如何透過 Gsutil 開啟 GCP storage 跨域請求
Continue Reading在某些作業系統,Git 會忽略檔名或資料夾名稱大小寫。這樣的設定會造成在同專案若修改檔案或資料夾大小寫,在執行 ```git
針對這狀況有幾個建議做法
Continue Reading| 符號 | 解釋 |
|---|---|
| ⌘ | Command |
| ⇧ | Shift |
| ⌃ | Control |
| ↩ | Enter/Return |
| ⌥ | Option / Alt |