nginx does't serve compressed static .html files. is it a bug?

peter petrov nginxuser at abv.bg
Fri Feb 6 21:22:22 UTC 2015










 -------- Оригинално писмо --------

От: Francis Daly francis at daoine.org

Относно: Re: nginx does't serve compressed static .html files. is it a bug?

До: nginx at nginx.org

Изпратено на: 05.02.2015 23:14


On Thu, Feb 05, 2015 at 10:28:33PM +0200, peter petrov wrote:



Hi there,



>  Francis Daly I did what you suggested but it doesn't work. Access.log says both times with --compressed or without it "200 162" for the nginx welcome screen.It is very weird.



It works for me:



# ls -l html/index.html*

-rw-r--r-- 1 root root 612 Jul 23  2013 html/index.html

-rw-r--r-- 1 root root 392 Feb  5 21:06 html/index.html.gz



# cat conf/nginx.conf

events {}

http {

  gzip_static on;

  server {

    listen 8080;

  }

}



# curl -i   http://localhost:8080/ 

[http 200, I see the content]



# curl -i --compressed  http://localhost:8080/ 

[http 200, I see the content]



# tail -n 2 logs/access.log

127.0.0.1 - - [05/Feb/2015:21:08:51 +0000] "GET / HTTP/1.1" 200 612 "-" "curl/7.15.5 (i386-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5"

127.0.0.1 - - [05/Feb/2015:21:08:57 +0000] "GET / HTTP/1.1" 200 392 "-" "curl/7.15.5 (i386-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5"





Repeat the test with exactly this configuration to see if it fails for you.



Or show exactly what you are doing so someone can see if it work for them.



Good luck with it,



	

Francis Daly         francis at daoine.org 


Hi ,


Thank you for your efforts and patience. Things are getting better here and I almost achieve your result
Nginx
 serves static files now., but writes smth above "Welcome to nginx!" 
index.html 00006440000... some numbers and finishes with Oustar 
rootroot.
1. sudo tar czvf index.html.gz index.html
2.sudo curl -i --compressed
 http://localhost:8080/


 or sudo curl -i http://localhost:8080/


 they both produce the same result index.html000064400000..... 
3. sudo tail -n 2 logs/access.log makes the same result "200 483"
 480B was the best I could achieve
using both tar and gzip -9 how did manage to get 392B out of 612B?




_______________________________________________

nginx mailing list

 nginx at nginx.org 

 http://mailman.nginx.org/mailman/listinfo/nginx 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20150206/9436e760/attachment.html>


More information about the nginx mailing list