nginx 出現413Request Entity Too Large問題是因為上傳的文件過大而導致的,Nginx默認的文件傳輸大小是1兆的大小,所以我們在傳大于1兆的文件時,要求進行設置修改,修改方案如下:
1.打開Nginx配置nginx.conf文件,此文件的路徑是:/etc/nginx/nginx.conf
2.在http{}中輸入client_max_body_size 10m,也可是輸入20,20兆是最大允許上傳大小。
3.最后保存重啟Nginx即可。
linux 系統下 nginx 安裝目錄和 nginx.conf 配置文件目錄查看方法:
查看Nginx安裝目錄:
輸入ps -ef | grep nginx,返回結果就會包含安裝目錄了;
root 8080 1 0 Aug27 ?
00:00:00 nginx: master process nginx -c /etc/nginx/nginx.conf
查看 nginx.conf 配置文件目錄:
輸入nginx -t,
返回結果即包含配置文件目錄:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
最后啟動Nginx服務器,
[root@localhost ~] <nginx安裝目錄> -c <nginx.conf配置文件目錄>
參數 “-c” 指定了配置文件的路徑,如果不加 “-c” 參數,Nginx 會默認加載其安裝目錄的 conf 子目錄中的 nginx.conf 文件。