AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题

问题[compression](server)

Martin Hope
allo
Asked: 2023-09-12 01:54:54 +0800 CST

“btrfs filesystem defrag -c”(压缩选项)是否强制压缩?

  • 6

启用压缩的 BTRFS 使用启发式方法来不压缩不能很好压缩的文件。使用“btrfs filesystem defrag -c”压缩现有文件是否也使用启发式,或者是否压缩所有文件,即使它们不能很好地压缩?

compression
  • 1 个回答
  • 45 Views
Martin Hope
user549144
Asked: 2020-12-26 22:37:45 +0800 CST

无法在 Apache 中关闭 SSLCompression?

  • 2

我的 Apache 是 2.4.46 并且使用的是 Openssl 版本 1.1.1f

我已经设置了指令SSLCompression Off。即使我启用它,它也会说不支持 SSL 压缩,我想这很好。

但是,当我使用 Firefox 查看网页的 HTTP 标头时,我会看到以下响应标头:

HTTP/2 200 OK
date: Fri, 25 Dec 2020 12:13:58 GMT
server: Apache
expires: -1
cache-control: no-store, no-cache, must-revalidate, max-age=0
pragma: no-cache
content-security-policy: default-src https: 'unsafe-inline' 'unsafe-hashes' 'self'; img-src data: https: 'self'
x-frame-options: DENY
x-xss-protection: 1; mode=block
x-content-type-options: nosniff
strict-transport-security: max-age=63072000; includeSubDomains; preload
referrer-policy: no-referrer
permissions-policy: geolocation=();midi=();notifications=();push=();sync-xhr=(self);microphone=();camera=();magnetometer=();gyroscope=();speaker=(self);vibrate=();fullscreen=(self);payment=();
vary: Accept-Encoding
content-encoding: gzip
content-length: 3299
content-type: text/html; charset=UTF-8
X-Firefox-Spdy: h2

那句话是:content-encoding: gzip让我担心。

但是,即使我使用 cURL 在 PHP 中使用此脚本来获取页面:

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
//enable headers
curl_setopt($ch, CURLOPT_HEADER, 1);
//get only headers
curl_setopt($ch, CURLOPT_NOBODY, 1);
curl_setopt($ch, CURLOPT_TIMEOUT_MS, 5000);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_2_0);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:84.0) Gecko/20100101 Firefox/84.0");
curl_setopt($ch, CURLOPT_ENCODING, "gzip");

它返回这些 HTTP 标头:


HTTP/2 200 
date: Fri, 25 Dec 2020 12:16:45 GMT
server: Apache
set-cookie: __Secure-CCJRLSESSID=g7m99kljvea2g5uk58f5lfskr1; path=/; secure; HttpOnly; SameSite=Lax
expires: -1
cache-control: no-store, no-cache, must-revalidate, max-age=0
pragma: no-cache
content-security-policy: default-src https: 'unsafe-inline' 'unsafe-hashes' 'self'; img-src data: https: 'self'
x-frame-options: DENY
x-xss-protection: 1; mode=block
x-content-type-options: nosniff
strict-transport-security: max-age=63072000; includeSubDomains; preload
referrer-policy: no-referrer
permissions-policy: geolocation=();midi=();notifications=();push=();sync-xhr=(self);microphone=();camera=();magnetometer=();gyroscope=();speaker=(self);vibrate=();fullscreen=(self);payment=();
content-type: text/html; charset=UTF-8

这让我很困惑。我什至清除了 Firefox 中的缓存,但没有运气。我不想受到 CRIME 攻击。反过来,我可以完全禁用 gzip。但在我这样做之前,我想知道为什么会发生这种情况。也许是 Firefox 的错误??

更新:

它也发生在 chrome 中。

mod_deflate 配置:

SSLCompression Off
<IfModule deflate_module>
  AddOutputFilterByType DEFLATE application/javascript
  AddOutputFilterByType DEFLATE application/rss+xml
  AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
  AddOutputFilterByType DEFLATE application/x-font
  AddOutputFilterByType DEFLATE application/x-font-opentype
  AddOutputFilterByType DEFLATE application/x-font-otf
  AddOutputFilterByType DEFLATE application/x-font-truetype
  AddOutputFilterByType DEFLATE application/x-font-ttf
  AddOutputFilterByType DEFLATE application/x-javascript
  AddOutputFilterByType DEFLATE application/xhtml+xml
  AddOutputFilterByType DEFLATE application/xml
  AddOutputFilterByType DEFLATE font/opentype
  AddOutputFilterByType DEFLATE font/otf
  AddOutputFilterByType DEFLATE font/ttf
  AddOutputFilterByType DEFLATE image/svg+xml
  AddOutputFilterByType DEFLATE image/x-icon
  AddOutputFilterByType DEFLATE text/css
  AddOutputFilterByType DEFLATE text/html
  AddOutputFilterByType DEFLATE text/javascript
  AddOutputFilterByType DEFLATE text/plain
  AddOutputFilterByType DEFLATE text/xml
</IfModule>
ssl compression gzip apache-2.4
  • 2 个回答
  • 691 Views
Martin Hope
Cyril Duchon-Doris
Asked: 2020-10-24 01:20:08 +0800 CST

通过 nginx reverse_proxy 保留 Cloudfront brotli 压缩

  • 0

我的问题类似于Nginx 反向代理到云端发行版并保留 gzip 压缩,但特别是关于在某些情况下应该比 gzip 执行更好的新 brotli 压缩算法

我的 AWS Cloudfront Distribution 支持 brotli

在此处输入图像描述

但是由于各种原因,我的网站在 nginx 代理后面,当 proxy_passing 请求到云端时,我失去了 brotli 压缩,我只得到 gzip。

我已经激活了 gzip 压缩和 gzip_proxied,是否有等效的方法可以从云端分发中保留 gzip 或 brotli 压缩?我听说过 nginx 的 brotli 模块和 2017 年的答案(示例),其中提到 proxy_pass 与 nginx + brotli 是不可能的,现在仍然如此吗?

server { 
  ...
  gzip on;
  gzip_comp_level 5;
  gzip_min_length 256;
  gzip_proxied any;
  gzip_vary on;
  gzip_types *;
compression nginx reverse-proxy amazon-cloudfront
  • 1 个回答
  • 551 Views
Martin Hope
20f2c98f50
Asked: 2020-08-10 14:33:00 +0800 CST

如何安装 nginx-module-brotli?

  • 1

我有一台带有 ubuntu 20.04 的服务器

但我无法nginx-module-brotli为我的 nginx 服务器安装。

以下是我用来为 Nginx 安装 Brotli 的命令:

$ sudo apt install git gcc cmake libpcre3 libpcre3-dev zlib1g zlib1g-dev openssl libssl-dev
$ wget https://nginx.org/download/nginx-1.18.0.tar.gz
$ tar zxvf nginx-1.18.0.tar.gz
$ git clone https://github.com/google/ngx_brotli.git
$ cd ~/ngx_brotli
$ git submodule update --init
$ cd ~/nginx-1.18.0
$ ./configure --with-compat --add-dynamic-module=../ngx_brotli
$ make modules
$ sudo cp ./objs/*.so /usr/share/nginx/modules
$ cd

和

$ sudo nano /etc/nginx/nginx.conf

load_module modules/ngx_http_brotli_filter_module.so;
load_module modules/ngx_http_brotli_static_module.so;

ubuntu@ov-ert6:~$ sudo systemctl restart nginx

ubuntu@ov-ert6:~$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

当我测试我的网站时,它在标题中找不到 Brotli:

在此处输入图像描述

ubuntu@ov-ert6:~$ sudo cat /etc/nginx/nginx.conf

load_module modules/ngx_http_brotli_filter_module.so;
load_module modules/ngx_http_brotli_static_module.so;
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
    worker_connections 768;
    # multi_accept on;
}

http {

    ##
    # Basic Settings
    ##

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;
    # server_tokens off;

    # server_names_hash_bucket_size 64;
    # server_name_in_redirect off;

    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    ##
    # SSL Settings
    ##

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
    ssl_prefer_server_ciphers on;

    ##
    # Logging Settings
    ##

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    ##
    # Gzip Settings
    ##

    gzip on;

    # gzip_vary on;
    # gzip_proxied any;
    # gzip_comp_level 6;
    # gzip_buffers 16 8k;
    # gzip_http_version 1.1;
    # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

    ##
    # Virtual Host Configs
    ##

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}


#mail {
#   # See sample authentication script at:
#   # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
# 
#   # auth_http localhost/auth.php;
#   # pop3_capabilities "TOP" "USER";
#   # imap_capabilities "IMAP4rev1" "UIDPLUS";
# 
#   server {
#       listen     localhost:110;
#       protocol   pop3;
#       proxy      on;
#   }
# 
#   server {
#       listen     localhost:143;
#       protocol   imap;
#       proxy      on;
#   }
#}

和

sudo nano /etc/nginx/sites-available/www-example-com.conf

server {
    listen 80 default_server;
    listen [::]:80;
    server_name example.com;

    location / {
        return 301 http://www.example.com$request_uri;
    }
}

server {
    listen 80;
    listen [::]:80;
    server_name www.example.com;
    root /var/www/www-example-com/web;
    index index.php;

    #add_header X-Frame-Options "SAMEORIGIN";
    add_header X-XSS-Protection "1; mode=block";
    #add_header X-Content-Type-Options "nosniff";
    add_header Referrer-Policy "strict-origin";
    add_header Content-Security-Policy "default-src 'self' 'unsafe-inline' https: data:; base-uri 'self';";
    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload";
    add_header Feature-Policy "speaker 'none';";

    gzip on;
    gzip_vary on;
    gzip_proxied any;
    gzip_comp_level 6;
    gzip_types text/plain text/css text/xml application/json application/javascript application/xml+rss application/atom+xml image/svg+xml;

    brotli on;
    brotli_comp_level 6;
    brotli_types text/plain text/css text/xml application/json application/javascript application/xml+rss application/atom+xml image/svg+xml;
}
ubuntu compression nginx make
  • 1 个回答
  • 3877 Views
Martin Hope
Mahmoud Moravej
Asked: 2017-03-14 22:05:24 +0800 CST

IIS Formal Brotli 压缩模块

  • 0

IIS 是否有任何正式的扩展来支持 brotli 压缩?以前我看到这两个扩展,但我不能依赖它们作为生产服务器:

  • https://www.iis.net/downloads/community/2016/03/iis-brotli
  • https://my.we-amp.com/downloads/iisbrotli
iis compression gzip windows-server-2012-r2
  • 1 个回答
  • 502 Views
Martin Hope
Andrew Bucklin
Asked: 2017-01-23 10:46:32 +0800 CST

NTFS 压缩和重复数据删除?

  • 8

我已经在 Windows Server 2016 上安装了重复数据删除角色。根据 Microsoft,它使用 NTFS 压缩来帮助节省空间:

重复数据删除在更少的物理空间中存储更多数据。与使用单实例存储 (SIS) 或 NTFS 压缩等功能相比,它实现了更高的存储效率。 https://technet.microsoft.com/en-us/library/hh831602(v=ws.11).aspx

  1. 我是否还应该在卷的属性中启用 NTFS 压缩(见下面的屏幕截图)?会有什么好处吗?

  2. 如果已经检查了怎么办?我应该取消选中它吗?检查会不会有负面影响?

截屏

compression ntfs file-server deduplication windows-server-2016
  • 1 个回答
  • 6055 Views
Martin Hope
Pradyumna Sagar
Asked: 2016-10-17 20:58:55 +0800 CST

如何压缩shell脚本文件中的文件?

  • -4

我在终端中看到了一个 .sh 文件,它在 sh 文件中提取了一些 jar 文件,如何创建这样的 sh 文件?我无法在普通 gedit 中打开该 sh 文件来检查内容。有没有办法做到这一点?

linux bash shell terminal compression
  • 2 个回答
  • 5681 Views
Martin Hope
artful
Asked: 2016-08-02 13:07:54 +0800 CST

流畅的弹性搜索压缩

  • 0

我使用 fluentd ( type tail) 将日志从应用服务器转发到弹性搜索服务器。不明白以下内容:

我可以启用以减少使用type tail或其他类型的压缩传输日志的流量吗?

logging compression elasticsearch fluentd
  • 1 个回答
  • 180 Views
Martin Hope
Met
Asked: 2016-06-28 06:17:03 +0800 CST

使用 LZO 压缩寻求 BTRFS 下的文件内部性能

  • 4

我计划在 50 TB RAID6 阵列上使用 btrfs,并且我想启用 lzo 压缩。

这适用于在大型(1 TB - 20 TB)文件中进行大量搜索的生物信息学设置。(该软件只获取分散在文件中的小块数据)。

让我担心的是,我不明白如何在 btrfs 等压缩文件系统上执行搜索。文件是否需要从头开始解压到抢手位置?这将对我的设置产生巨大的负面影响。

或者更一般的问题:文件大小的寻道时间尺度是否与非压缩文件系统相同还是变得更糟,例如 O(file_length)

performance compression btrfs
  • 2 个回答
  • 1364 Views
Martin Hope
Diagon
Asked: 2016-01-09 12:38:28 +0800 CST

在 lzo 压缩的 BtrFS 之间复制:de/re-compressing?

  • 2

我在安装在同一台机器上的不同驱动器上的两个 lzo 压缩 BtrFS 文件系统之间复制大量文件。似乎正在对文件进行解压缩/重新压缩。有没有办法避免这种情况?

compression
  • 2 个回答
  • 166 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve