❶ 如何解決nginx+tomcat文件上傳問題
你看看靜態頁面能通過nginx訪問不?是否設置正確nginx配置裡面root指向的目錄路徑 我是這內樣配置的: listen 80; server_name localhost; index index.html index.htm index.jsp; root /usr/local/webserver/apache-tomcat-6.0.26/webapps,上傳沒得容問題
❷ 如何解決nginx上傳文件大小限制
新裝了一台伺服器,用nginx做代理。突然發現上傳超過1M大的客戶端文件無法正常上傳,於是修改了下nginx的配置。
cd /export/servers/nginx/conf/nginx.conf,在這個配置文件裡面的server段裡面的
[plain] view plain print?
location / {
root html;
index index.html index.htm;
client_max_body_size 1000m;
}
location / {
root html;
index index.html index.htm;
client_max_body_size 1000m;
}
加上了client_max_body_size 欄位,怎麼重啟都不行。後來在總配置文件裡面發現了分配置文件:
[plain] view plain print?
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
include domains/*; #########################分配置文件路徑在此
#include domains/chat.local;
#include domains/chat.erp.com;
#include domains/support.chat.com;
#include douains/chat.com;
server {
listen 80;
server_name localhost;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
include domains/*; #########################分配置文件路徑在此
#include domains/chat.local;
#include domains/chat.erp.com;
#include domains/support.chat.com;
#include douains/chat.com;
server {
listen 80;
server_name localhost;
include domains/*命令指定了分配置文件的路徑。找到了分配置文件後,在分配置文件裡面進行修改。分配置文件配置如下:
[plain] view plain print?
server
{
listen 80;
server_name chat.erp.360buy.com;
#access_log /export/servers/nginx/logs/chat.erp.360buy.com;
location / {
proxy_pass http://tomcat;
client_max_body_size 1000m;
}
}
server
{
listen 80;
server_name chat.erp.360buy.com;
#access_log /export/servers/nginx/logs/chat.erp.360buy.com;
location / {
proxy_pass http://tomcat;
client_max_body_size 1000m;
}
}
用/export/servers/nginx/sbin/nginx -s reload重啟下,上傳文件的大小受限的問題就解決了。
分享下我的解決過程,希望對大家有幫助。
❸ 如何解決nginx+tomcat文件上傳問題
最常用的方法是通過設置nginx的client_max_body_size解決nginx+php上傳大文件,主要是設置上傳豎緩文件大小和php腳本運行時長鬧攔即液纖胡可。