問題:
其實幾個問題類似
1..如何在MAMP PRO中配置nginx上的server指令?
2.在MAMP PRO for mac中nginx 報錯 413 Request Entity Too Large?
3.在MAMP PRO for mac中nginx如何配置 client_max_body_size 指令?
3.圖片上傳報錯 413 Request Entity Too Large?
環境:
系統:mac mini v10.11.5
MAMP PRO for mac : 4.4.1 (9605)
tp版本:TP5.1.39
client_max_body_size 20m; # 請求實體大小限制爲20MB;
爲nginx的虛擬主機(即server)添加client_max_body_size 20m; 指令,如下
server {
server_name MAMP_VirtualHost_ServerName_MAMP;
listen MAMP_IP_Port_MAMP;
MAMP_VirtualHost_ServerAliases_MAMP
client_max_body_size 20m; # 請求實體大小限制爲20MB;
root "MAMP_VirtualHost_DocumentRoot_MAMP";
location / {
try_files MAMP_Try_Files_MAMP;
index MAMP_VirtualHost_DirectoryIndex_MAMP;
autoindex MAMP_VirtualHost_AutoIndex_MAMP;
MAMP_VirtualHost_Allow_MAMP
MAMP_VirtualHost_Deny_MAMP
MAMP_LocationCustom_MAMP
}
}
以上操作在mamp pro上的操作應該如下: