nginx配置 send_timeout 引发的js、css解析失败问题

本文介绍了一种解决Web界面排版错误及JS、CSS文件加载失败的方法。在排查路径问题和配置文件问题无效后,通过调整nginx配置中的send_timeout参数成功解决了加载超时的问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

错误情况是web界面排版错误,js、css文件加载失败,通过调试器查看js和css文件路径都是对的,而且可访问。

业务使用的是 nginx+php+mysql+redis的架构

 

解决办法;

查了很多资料有的是路径问题,有的是   include             /etc/nginx/mime.types;文件问题,都没有解决我对问题,

 

最终更改了send_timeout 的超时时间, (nginx.conf)

send_timeout :后端服务器数据回传时间_就是在规定时间之内后端服务器必须传完所有的数据,设置比较短的话就会导致js文件没有加载完就超时了。。。

转载于:https://www.cnblogs.com/liuquan/p/9052302.html

解读代码user root; worker_processes 8; worker_rlimit_nofile 65535; worker_cpu_affinity auto; error_log /data/logs/nginx/error.log warn; pid /data/logs/nginx/nginx.pid; events { use epoll; worker_connections 65535; multi_accept off; } http { include mime.types; default_type application/octet-stream; server_names_hash_bucket_size 3526; server_names_hash_max_size 4096; log_format combined_realip '$remote_addr $http_x_forwarded_for [$time_local]' ' $host "$request_uri" $status' ' "$http_referer" "$http_user_agent"'; server_tokens off; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 60; open_file_cache max=10240 inactive=30s; open_file_cache_valid 30s; open_file_cache_min_uses 1; proxy_read_timeout 90; proxy_connect_timeout 90; proxy_send_timeout 600; proxy_buffers 4 32k; proxy_busy_buffers_size 64k; client_header_timeout 60; client_body_timeout 300; reset_timedout_connection on; send_timeout 60; connection_pool_size 256; client_header_buffer_size 4k; large_client_header_buffers 8 16k; request_pool_size 4k; output_buffers 4 32k; postpone_output 1460; client_max_body_size 2048m; client_body_buffer_size 2m; client_body_temp_path /data/logs/nginx/client_body_temp; proxy_temp_path /data/logs/nginx/proxy_temp; proxy_cache_path /data/logs/nginx/proxy_cache levels=1:2 keys_zone=cache_one:100m inactive=1d max_size=1g; fastcgi_temp_path /data/logs/nginx/fastcgi_temp; fastcgi_intercept_errors on; gzip on; gzip_min_length 1k; gzip_buffers 4 32k; gzip_comp_level 5; gzip_http_version 1.1; gzip_types text/plain text/css text/htm text/javascript application/x-javascript application/xml application/json; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for""$request_time"'; include ../conf.d/*.conf; }
最新发布
06-21
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值