日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > Nginx >内容正文

Nginx

Nginx sendfile作用

發布時間:2023/12/8 Nginx 46 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Nginx sendfile作用 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

sendfile位置

查看nginx.conf文件 標黃位置

#user nobody; worker_processes 1;#error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info;#pid logs/nginx.pid;events {worker_connections 1024; }http {include mime.types;default_type application/octet-stream;server_names_hash_bucket_size 128;#請求行+請求頭的標準大小client_header_buffer_size 16k;#請求行+請求頭的最大大小 4*16klarge_client_header_buffers 4 16k;#log_format main '$remote_addr - $remote_user [$time_local] "$request" '# '$status $body_bytes_sent "$http_referer" '# '"$http_user_agent" "$http_x_forwarded_for"';#access_log logs/access.log main;**sendfile on;**#tcp_nopush on;#keepalive_timeout 0;keepalive_timeout 65;#gzip on;# another virtual host using mix of IP-, name-, and port-based configuration##server {# listen 8000;# listen somename:8080;# server_name somename alias another.alias;# location / {# root html;# index index.html index.htm;# }#}#include vhosts.conf;#include vhosts/*.conf;# HTTPS server##server {# listen 443 ssl;# server_name localhost;# ssl_certificate cert.pem;# ssl_certificate_key cert.key;# ssl_session_cache shared:SSL:1m;# ssl_session_timeout 5m;# ssl_ciphers HIGH:!aNULL:!MD5;# ssl_prefer_server_ciphers on;# location / {# root html;# index index.html index.htm;# }#}server {listen 8085; server_name localhost dev.heating.com;location /man {proxy_pass http://127.0.0.1:8405/;proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;proxy_set_header X-Forwarded-For $http_x_forwarded_for;}location /fs {proxy_pass http://127.0.0.1:8080/;proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;proxy_set_header X-Forwarded-For $http_x_forwarded_for;}location / {root D:\heating\dist;index index.html index.htm;}} client_max_body_size 50m; }

網絡文件傳輸
1.工作原理圖

2. 工作原理描述:
sendfile = off 時,應用程序讀取磁盤中的文件以字節流的形式從磁盤中加載文件,然后再將文件以字節流的形式復制到內核中。內核在把文件推送到NC。
sendfile = on 時,應用程序直接向內核發送指令,讓內核去讀文件。讀完文件內核直接推送給NC。只有一次復制操作,實現異步網絡IO形式。因此,性能會有很大的提升。
具體還要根據實際使用情況來配置sendfile。當讀取服務不能解析大量的文件時。還是建議將sendfile配置為off

總結

以上是生活随笔為你收集整理的Nginx sendfile作用的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。