Nginx代理上传文件大小设置

一,安装nginx配置
进入nginx配置文件–>conf–>nginx.conf
在这里插入图片描述


#user  nobody;
worker_processes  5;
events {
    
    
    worker_connections  10240;
}
rtmp_auto_push on;
rtmp_auto_push_reconnect 1s;
rtmp_socket_dir /tmp;
rtmp{
    
    
	out_queue 4096;
	out_cork 8;
	max_streams 128;
	log_interval 5s;
	log_size 1m;
	server{
    
    
	 listen 1935;
	 server_name localhost;
	 application live{
    
    
		 live on;
		 gop_cache on;
		 hls on; #这个参数把直播服务器改造成实时回放服务器。
		 wait_key on; #对视频切片进行保护,这样就不会产生马赛克了。
		 hls_path /vrs/trs/vod/mp4/hls; #切片视频文件存放位置。
		 hls_fragment 10s;     #每个视频切片的时长。
		 hls_playlist_length 60s;  #总共可以回看的事件,这里设置的是1分钟。
		 hls_continuous on; #连续模式。
		 hls_cleanup on;    #对多余的切片进行删除。
		 hls_nested on;     #嵌套模式。
		 dash on;
	     dash_path /vrs/trs/vod/mp4/dash;
	  }
	}
}

http {
    
    
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
	#配置tomcat(nginx代理)
	upstream www.xxx.com{
    
    
      ip_hash;
       server localhost:8080 weight=1;  #权重
	}
           server{
    
    
                listen 8937;
                server_name localhost;

                location / {
    
    
                     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                    proxy_set_header Host $http_host;
                    proxy_set_header X-Forwarded-Proto https;
                    client_max_body_size    10240m;  #nginx配置上传文件大小(10G)
                    proxy_redirect off;
                    proxy_connect_timeout      240;
                    proxy_send_timeout         240;
                    proxy_read_timeout         240;
                    proxy_http_version 1.1;
                    proxy_set_header Upgrade $http_upgrade;
                    proxy_set_header Connection "upgrade";
                    # note, there is not SSL here! plain HTTP is used
                    proxy_pass http://www.testencode.com;
                }
            }
    server {
    
    
        listen       80;
	    server_name  localhost;
       location / {
    
    
				root /vrs/trs/;
				index admin/login.html;
			}
		location ~ .*.[jsp|do|action]$ {
    
     #所有jsp页面以及do/action请求均交由   tomcat处理
				index index.jsp;
				proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
				proxy_set_header Host $http_host;
				proxy_set_header X-Forwarded-Proto https;
				client_max_body_size    10240m; #nginx配置上传文件大小(10G)
				proxy_redirect off;
				proxy_connect_timeout      240;
				proxy_send_timeout         240;
				proxy_read_timeout         3600;
				proxy_http_version 1.1;
				proxy_set_header Upgrade $http_upgrade;
				proxy_set_header Connection "upgrade";
				# note, there is not SSL here! plain HTTP is used
				proxy_pass http://www.trs.com;
			}

		location /dwr {
    
    
				proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
				proxy_set_header Host $http_host;
				proxy_set_header X-Forwarded-Proto https;
				client_max_body_size    1000m;
				proxy_redirect off;
				proxy_connect_timeout      240;
				proxy_send_timeout         240;
				proxy_read_timeout         240;
				proxy_http_version 1.1;
				proxy_set_header Upgrade $http_upgrade;
				proxy_set_header Connection "upgrade";
				# note, there is not SSL here! plain HTTP is used
				proxy_pass http://www.trs.com;
			}

		location /webservice {
    
    
				proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
				proxy_set_header Host $http_host;
				proxy_set_header X-Forwarded-Proto https;
				client_max_body_size    1000m;
				proxy_redirect off;
				proxy_connect_timeout      240;
				proxy_send_timeout         240;
				proxy_read_timeout         240;
				# note, there is not SSL here! plain HTTP is used
				proxy_pass http://www.trs.com;

			}
		location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|apk|tar.gz)$
			{
    
    
              root /vrs/trs/;
			  expires      30d;

			}
		location ~ .*\.(js|css)?$
			{
    
    
              root /vrs/trs/;
			  expires      -1;

		    }
		location /live{
    
       #rtmp转http直播码流
			flv_live on;
			chunked_transfer_encoding  on; #open 'Transfer-Encoding: chunked' response
			add_header 'Access-Control-Allow-Credentials' 'true'; #add additional HTTP header
			add_header 'Access-Control-Allow-Origin' '*'; #add additional HTTP header
			add_header Access-Control-Allow-Headers X-Requested-With;
			add_header Access-Control-Allow-Methods GET,POST,OPTIONS;
			add_header 'Cache-Control' 'no-cache';
	   }
		location /dash {
    
    
				root /vrs/trs/vod/mp4/dash;
				add_header 'Cache-Control' 'no-cache';
			}
		location /stat {
    
    
				#configuration of push & pull status
				  rtmp_stat all;
				  rtmp_stat_stylesheet stat.xsl;
			 }
		location /stat.xsl {
    
    
		  root /usr/local/nginx/nginx-http-flv-module;
		}
		location /control {
    
    
				rtmp_control all; #configuration of control module of rtmp
			}

		error_page   500 502 503 504  /50x.html;
		location = /50x.html {
    
    
			root   html;
		}
    }
}

二,重启nginx服务
nginx相关命令:

 /usr/local/nginx/sbin/ ./nginx    #启动nginx服务
/usr/local/nginx/sbin/ ./nginx -s stop  #关闭nginx服务
/usr/local/nginx/sbin/ ./nginx -s reload  #重启nginx服务

猜你喜欢

转载自blog.csdn.net/weixin_44975322/article/details/119183424
今日推荐