peytonyip / docker-nginx-brotli

MIT License
3 stars 0 forks source link

I cannot see Accept-Encoding: br in the dev inspector #57

Open jomavazquez opened 1 month ago

jomavazquez commented 1 month ago

Hi peytonyip!

I'm using your package at: https://hub.docker.com/r/peytonyip/nginx-brotli and follow your instructions, but I cannot see Accept-Encoding: br in my localhost.

In my nginx.conf I have this:

brotli

brotli on;
brotli_comp_level 10;
brotli_buffers 16 8k;
brotli_min_length 20;
brotli_static on;
brotli_types text/plain tex ...

but I'm missing some lines for load_modules or something I guess. All of the docker containers (wordpress, mysql, nginx with your image is running fine) but no trail of brotli.

What I'm doing wrong?

Thank you!

peytonyip commented 1 month ago

In the current image, ngx_brotli is statically compiled and does not depend on other modules.

Are you using HTTPS with a domain name for your setup? Or could you provide a more complete configuration and log files for further analysis?

PS: apologize for any delays in my responses due to a busy workload. Thank you for your understanding.

jomavazquez commented 1 month ago

Hi Payton,

Well, I was trying in my localhost, so only for 80 port.

Does your image only work with https?

Thank you

—————

Saludos / Best regards José María Vázquez

El 12 may 2024, a las 12:28, Payton Yip @.***> escribió:

In the current image, ngx_brotli is statically compiled and does not depend on other modules.

Are you using HTTPS with a domain name for your setup? Or could you provide a more complete configuration and log files for further analysis?

PS: apologize for any delays in my responses due to a busy workload. Thank you for your understanding.

— Reply to this email directly, view it on GitHub https://github.com/peytonyip/docker-nginx-brotli/issues/57#issuecomment-2106198923, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABFREOYVFY6A3PTQKN5UV2TZB474TAVCNFSM6AAAAABHOSEQVWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBWGE4TQOJSGM. You are receiving this because you authored the thread.

peytonyip commented 1 month ago

Hi, I tested image work with http.

I used docker run -p 80:80 --rm peytonyip/nginx-brotli:1.25.5 PixPin_2024-05-25_14-31-50

and open http://localhost/ in the browser and see Accept-Encoding: gzip, deflate, br, zstd and Content-Encoding: br PixPin_2024-05-25_14-50-07

Maybe you can check brotli_types or others, you can refer to Sample configuration

jomavazquez commented 1 month ago

Hi Payton,

I’ve tried now with your image. This is my docker compose:

nginx: depends_on:

And my nginx.conf:

user nginx; worker_processes auto; worker_cpu_affinity auto 1111; worker_rlimit_nofile 102400; thread_pool io-pool threads=1024;

error_log /var/log/nginx/error.log notice; pid /var/run/nginx.pid;

events { worker_connections 1024; multi_accept on; use epoll; }

http {

real_ip_header X-Forwarded-For;

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

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  /var/log/nginx/access.log main;

# --------------- Basic Settings ---------------
sendfile on;
sendfile_max_chunk 512k;
autoindex off;
tcp_nopush on;
tcp_nodelay on;
server_tokens off;
access_log off;
reset_timedout_connection on;
ignore_invalid_headers on;
open_file_cache max=10000 inactive=10m;
open_file_cache_valid 2m;
open_file_cache_min_uses 5;
open_file_cache_errors off;
lingering_time 20;
lingering_timeout 5s;

# Brotli support
brotli on;
brotli_comp_level 9;
brotli_buffers 64 16k;
brotli_window 512k;
brotli_min_length 300;
brotli_static on;
brotli_types text/plain text/xml text/css text/js text/javascrip application/atom+xml application/json application/xhtml+xml application/xml+rss application/x-font-ttf application/x-font-opentypeapplication/vnd.ms-fontobject application/javascript application/x-javascript application/rss+xml application/x-font-truetype application/xml font/tff font/eot font/otf font/opentype font/truetype image/x-icon image/svg+xml image/vnd.microsoft.icon image/x-win-bitmapt;

## GZip support
#gzip on;
#gzip_comp_level 8;
#gzip_static on;
#gzip_disable "msie6";
#gzip_vary on;
#gzip_proxied any;
#gzip_min_length 20;
#gzip_buffers 64 8k;
#gzip_http_version 1.1;
#gzip_types text/plain text/xml text/css text/js text/javascript text/x-javascript text/x-component application/atom+xml application/json application/xhtml+xml application/xml+rss application/x-font-ttf application/x-font-opentype application/vnd.ms-fontobject application/javascript application/x-javascript application/rss+xml application/x-font-truetype application/xml font/tff font/eot font/otf font/opentype font/truetype image/x-icon image/svg+xml image/vnd.microsoft.icon image/x-win-bitmapt;

## Buffers configuration
client_body_buffer_size 20m;
client_header_buffer_size 32k;
client_max_body_size 30m;
large_client_header_buffers 16 32k;
fastcgi_buffer_size 512k;
fastcgi_buffers 16 512k;

## Timeouts configuration
client_body_timeout 30;
client_header_timeout 30;
keepalive_timeout 65;
keepalive_requests 10000;
keepalive_disable msie6;
send_timeout 30;
connection_pool_size 2048;
request_pool_size 64k;
postpone_output 0;
types_hash_max_size 2048;

include /etc/nginx/conf.d/*.conf;

}

Sadly, nginx now is not up. This is from my docker desktop application log: 2024-05-25 10:17:48 nginx: [emerg] could not build test_types_hash, you should increase test_types_hash_bucket_size: 64 2024-05-25 10:17:50 2024/05/25 08:17:50 [emerg] 1#1: could not build test_types_hash, you should increase test_types_hash_bucket_size: 64

Probably I’m missing something in the nginx.conf file. (I have another one regarding the website but there is no options over there).

Thank you for your support.

—————

Saludos / Best regards José María Vázquez

El 25 may 2024, a las 8:44, Payton Yip @.***> escribió:

Hi, I tested image work with http.

I used docker run -p 80:80 --rm peytonyip/nginx-brotli:1.25.5 PixPin_2024-05-25_14-31-50.png (view on web) https://github.com/peytonyip/docker-nginx-brotli/assets/28802445/2ff66e98-6b29-4850-8eaf-559e81390cd7 and open http://127.0.0.1/ in the browser and see Accept-Encoding: br

PixPin_2024-05-25_14-31-07.png (view on web) https://github.com/peytonyip/docker-nginx-brotli/assets/28802445/9c0ed04a-627b-4e02-b9a8-a2e1bfb248e2 Maybe you can check brotli_types or others, you can refer to Sample configuration https://github.com/google/ngx_brotli?tab=readme-ov-file#sample-configuration — Reply to this email directly, view it on GitHub https://github.com/peytonyip/docker-nginx-brotli/issues/57#issuecomment-2130941502, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABFREO2HVXHRB7TJISOGUT3ZEAXN5AVCNFSM6AAAAABHOSEQVWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZQHE2DCNJQGI. You are receiving this because you authored the thread.

jomavazquez commented 1 month ago

Hey,

I’ve googling a little bit, and I had a typo in: brotli_types text/plain text/xml text/css text/js text/javascript application/atom+xml application/json application/xhtml+xml application/xml+rss application/x-font-ttf application/x-font-opentype application/vnd.ms-fontobject application/javascript application/x-javascript application/rss+xml application/x-font-truetype application/xml font/tff font/eot font/otf font/opentype font/truetype image/x-icon image/svg+xml image/vnd.microsoft.icon image/x-win-bitmapt;

Now it is fixed and every container is running;

But, I cannot see the encoding:

Any idea?

—————

Saludos / Best regards José María Vázquez

El 25 may 2024, a las 8:53, Payton Yip @.***> escribió:

1.25.5

jomavazquez commented 1 month ago

Hi Payton,Last update:Finally it works! I’m not able to use it in localhost, but in the server with https works quite well:Https://www.psmexamsimulator.comThank you so much!Saludos / Best regards,José María VázquezEl 25 may 2024, a las 10:22, José María Vázquez Vicaria @.**> escribió:Hi Payton,I’ve tried now with your image. This is my docker compose: nginx: depends_on: - website #image: nginx:1.26.0-alpine image: peytonyip/nginx-brotli:1.26.0 container_name: ${PROJECT_NAME}-nginx restart: unless-stopped ports: - "80:80" volumes: - /Users/kiwi/Development/php/${PROJECT_NAME}/config/nginx/nginx.conf:/etc/nginx/nginx.conf - /Users/kiwi/Development/php/${PROJECT_NAME}/config/nginx/conf.d:/etc/nginx/conf.d - /Users/kiwi/Development/php/${PROJECT_NAME}/web:/var/www/html And my nginx.conf:user nginx;worker_processes auto;worker_cpu_affinity auto 1111;worker_rlimit_nofile 102400;thread_pool io-pool threads=1024;error_log /var/log/nginx/error.log notice;pid /var/run/nginx.pid;events { worker_connections 1024; multi_accept on; use epoll;}http { real_ip_header X-Forwarded-For; include /etc/nginx/mime.types; default_type application/octet-stream; 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 /var/log/nginx/access.log main; # --------------- Basic Settings --------------- sendfile on; sendfile_max_chunk 512k; autoindex off; tcp_nopush on; tcp_nodelay on; server_tokens off; access_log off; reset_timedout_connection on; ignore_invalid_headers on; open_file_cache max=10000 inactive=10m; open_file_cache_valid 2m; open_file_cache_min_uses 5; open_file_cache_errors off; lingering_time 20; lingering_timeout 5s; # Brotli support brotli on; brotli_comp_level 9; brotli_buffers 64 16k; brotli_window 512k; brotli_min_length 300; brotli_static on; brotli_types text/plain text/xml text/css text/js text/javascrip application/atom+xml application/json application/xhtml+xml application/xml+rss application/x-font-ttf application/x-font-opentypeapplication/vnd.ms-fontobject application/javascript application/x-javascript application/rss+xml application/x-font-truetype application/xml font/tff font/eot font/otf font/opentype font/truetype image/x-icon image/svg+xml image/vnd.microsoft.icon image/x-win-bitmapt; ## GZip support #gzip on; #gzip_comp_level 8; #gzip_static on; #gzip_disable "msie6"; #gzip_vary on; #gzip_proxied any; #gzip_min_length 20; #gzip_buffers 64 8k; #gzip_http_version 1.1; #gzip_types text/plain text/xml text/css text/js text/javascript text/x-javascript text/x-component application/atom+xml application/json application/xhtml+xml application/xml+rss application/x-font-ttf application/x-font-opentype application/vnd.ms-fontobject application/javascript application/x-javascript application/rss+xml application/x-font-truetype application/xml font/tff font/eot font/otf font/opentype font/truetype image/x-icon image/svg+xml image/vnd.microsoft.icon image/x-win-bitmapt; ## Buffers configuration client_body_buffer_size 20m; client_header_buffer_size 32k; client_max_body_size 30m; large_client_header_buffers 16 32k; fastcgi_buffer_size 512k; fastcgi_buffers 16 512k; ## Timeouts configuration client_body_timeout 30; client_header_timeout 30; keepalive_timeout 65; keepalive_requests 10000; keepalive_disable msie6; send_timeout 30; connection_pool_size 2048; request_pool_size 64k; postpone_output 0; types_hash_max_size 2048; include /etc/nginx/conf.d/.conf;}Sadly, nginx now is not up. This is from my docker desktop application log:2024-05-25 10:17:48 nginx: [emerg] could not build test_types_hash, you should increase test_types_hash_bucket_size: 642024-05-25 10:17:50 2024/05/25 08:17:50 [emerg] 1#1: could not build test_types_hash, you should increase test_types_hash_bucket_size: 64Probably I’m missing something in the nginx.conf file. (I have another one regarding the website but there is no options over there).Thank you for your support.—————Saludos / Best regardsJosé María Vázquez

El 25 may 2024, a las 8:44, Payton Yip @.> escribió:Hi, I tested image work with http.I used docker run -p 80:80 --rm peytonyip/nginx-brotli:1.25.5 PixPin_2024-05-25_14-31-50.png (view on web)and open http://127.0.0.1/ in the browser and see Accept-Encoding: brPixPin_2024-05-25_14-31-07.png (view on web)Maybe you can check brotli_types or others, you can refer to Sample configuration—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.>