NGINX gzip per virtualhost?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I know here are a lot of "similar" Q's, but anyway...



So – I have a nginx.conf with gzip on;. It's a new, clean Linux server, nothing yet done here.



Using curl – I can see gzip enabled:



$ curl -I -H "Accept-Encoding: gzip,deflate" gzip.setevoy.kiev.ua/
HTTP/1.1 200 OK
Server: nginx/1.10.3
Date: Wed, 19 Sep 2018 14:26:40 GMT
Content-Type: text/html
Last-Modified: Wed, 19 Sep 2018 13:56:35 GMT
Connection: keep-alive
ETag: W/"5ba25593-264"
Content-Encoding: gzip


Now – I'm adding simple config conf.d/gzip.setevoy.kiev.ua.conf:



server 

listen 80;
server_name gzip.setevoy.kiev.ua;

root /var/www/etag;
index index.html;



And now – no gzip enabled:



$ curl -I -H "Accept-Encoding: gzip,deflate" gzip.setevoy.kiev.ua/
HTTP/1.1 200 OK
Server: nginx/1.10.3
Date: Wed, 19 Sep 2018 14:28:00 GMT
Content-Type: text/html
Content-Length: 7
Last-Modified: Wed, 19 Sep 2018 13:58:46 GMT
Connection: keep-alive
ETag: "5ba25616-7"
Accept-Ranges: bytes


Adding gzip on; directly to the conf.d/gzip.setevoy.kiev.ua.conf didn't help. Same if set gzip off; in the nginx.conf and gzip on; to the virtualhost's conf.



What I'm doing wrong here?



P.S. gzip_vary on;, gzip_types * etc., didn't help either.










share|improve this question



















  • 1




    IMO this is worth leaving open because it's a good catch on a subtle problem.
    – roaima
    Sep 24 at 8:50














up vote
0
down vote

favorite












I know here are a lot of "similar" Q's, but anyway...



So – I have a nginx.conf with gzip on;. It's a new, clean Linux server, nothing yet done here.



Using curl – I can see gzip enabled:



$ curl -I -H "Accept-Encoding: gzip,deflate" gzip.setevoy.kiev.ua/
HTTP/1.1 200 OK
Server: nginx/1.10.3
Date: Wed, 19 Sep 2018 14:26:40 GMT
Content-Type: text/html
Last-Modified: Wed, 19 Sep 2018 13:56:35 GMT
Connection: keep-alive
ETag: W/"5ba25593-264"
Content-Encoding: gzip


Now – I'm adding simple config conf.d/gzip.setevoy.kiev.ua.conf:



server 

listen 80;
server_name gzip.setevoy.kiev.ua;

root /var/www/etag;
index index.html;



And now – no gzip enabled:



$ curl -I -H "Accept-Encoding: gzip,deflate" gzip.setevoy.kiev.ua/
HTTP/1.1 200 OK
Server: nginx/1.10.3
Date: Wed, 19 Sep 2018 14:28:00 GMT
Content-Type: text/html
Content-Length: 7
Last-Modified: Wed, 19 Sep 2018 13:58:46 GMT
Connection: keep-alive
ETag: "5ba25616-7"
Accept-Ranges: bytes


Adding gzip on; directly to the conf.d/gzip.setevoy.kiev.ua.conf didn't help. Same if set gzip off; in the nginx.conf and gzip on; to the virtualhost's conf.



What I'm doing wrong here?



P.S. gzip_vary on;, gzip_types * etc., didn't help either.










share|improve this question



















  • 1




    IMO this is worth leaving open because it's a good catch on a subtle problem.
    – roaima
    Sep 24 at 8:50












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I know here are a lot of "similar" Q's, but anyway...



So – I have a nginx.conf with gzip on;. It's a new, clean Linux server, nothing yet done here.



Using curl – I can see gzip enabled:



$ curl -I -H "Accept-Encoding: gzip,deflate" gzip.setevoy.kiev.ua/
HTTP/1.1 200 OK
Server: nginx/1.10.3
Date: Wed, 19 Sep 2018 14:26:40 GMT
Content-Type: text/html
Last-Modified: Wed, 19 Sep 2018 13:56:35 GMT
Connection: keep-alive
ETag: W/"5ba25593-264"
Content-Encoding: gzip


Now – I'm adding simple config conf.d/gzip.setevoy.kiev.ua.conf:



server 

listen 80;
server_name gzip.setevoy.kiev.ua;

root /var/www/etag;
index index.html;



And now – no gzip enabled:



$ curl -I -H "Accept-Encoding: gzip,deflate" gzip.setevoy.kiev.ua/
HTTP/1.1 200 OK
Server: nginx/1.10.3
Date: Wed, 19 Sep 2018 14:28:00 GMT
Content-Type: text/html
Content-Length: 7
Last-Modified: Wed, 19 Sep 2018 13:58:46 GMT
Connection: keep-alive
ETag: "5ba25616-7"
Accept-Ranges: bytes


Adding gzip on; directly to the conf.d/gzip.setevoy.kiev.ua.conf didn't help. Same if set gzip off; in the nginx.conf and gzip on; to the virtualhost's conf.



What I'm doing wrong here?



P.S. gzip_vary on;, gzip_types * etc., didn't help either.










share|improve this question















I know here are a lot of "similar" Q's, but anyway...



So – I have a nginx.conf with gzip on;. It's a new, clean Linux server, nothing yet done here.



Using curl – I can see gzip enabled:



$ curl -I -H "Accept-Encoding: gzip,deflate" gzip.setevoy.kiev.ua/
HTTP/1.1 200 OK
Server: nginx/1.10.3
Date: Wed, 19 Sep 2018 14:26:40 GMT
Content-Type: text/html
Last-Modified: Wed, 19 Sep 2018 13:56:35 GMT
Connection: keep-alive
ETag: W/"5ba25593-264"
Content-Encoding: gzip


Now – I'm adding simple config conf.d/gzip.setevoy.kiev.ua.conf:



server 

listen 80;
server_name gzip.setevoy.kiev.ua;

root /var/www/etag;
index index.html;



And now – no gzip enabled:



$ curl -I -H "Accept-Encoding: gzip,deflate" gzip.setevoy.kiev.ua/
HTTP/1.1 200 OK
Server: nginx/1.10.3
Date: Wed, 19 Sep 2018 14:28:00 GMT
Content-Type: text/html
Content-Length: 7
Last-Modified: Wed, 19 Sep 2018 13:58:46 GMT
Connection: keep-alive
ETag: "5ba25616-7"
Accept-Ranges: bytes


Adding gzip on; directly to the conf.d/gzip.setevoy.kiev.ua.conf didn't help. Same if set gzip off; in the nginx.conf and gzip on; to the virtualhost's conf.



What I'm doing wrong here?



P.S. gzip_vary on;, gzip_types * etc., didn't help either.







nginx gzip






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 25 at 2:16









G-Man

11.9k92658




11.9k92658










asked Sep 19 at 14:31









setevoy

5141823




5141823







  • 1




    IMO this is worth leaving open because it's a good catch on a subtle problem.
    – roaima
    Sep 24 at 8:50












  • 1




    IMO this is worth leaving open because it's a good catch on a subtle problem.
    – roaima
    Sep 24 at 8:50







1




1




IMO this is worth leaving open because it's a good catch on a subtle problem.
– roaima
Sep 24 at 8:50




IMO this is worth leaving open because it's a good catch on a subtle problem.
– roaima
Sep 24 at 8:50










1 Answer
1






active

oldest

votes

















up vote
2
down vote













OK, that was simple - but I wasted a lot of time trying to figure it out. Maybe will be helpful for somebody else.



Everything was good with configs, but let's take a look on to the documentation:




Syntax: gzip_min_length length;
Default: gzip_min_length 20;




And guess what? I tested it with index.html with one word added... Obviously, its size was < 20 bytes so NGINX didn't apply gzip on it.



So I just added gzip_min_length 0; to the nginx.conf - and all works now.






share|improve this answer






















    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f470034%2fnginx-gzip-per-virtualhost%23new-answer', 'question_page');

    );

    Post as a guest






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    2
    down vote













    OK, that was simple - but I wasted a lot of time trying to figure it out. Maybe will be helpful for somebody else.



    Everything was good with configs, but let's take a look on to the documentation:




    Syntax: gzip_min_length length;
    Default: gzip_min_length 20;




    And guess what? I tested it with index.html with one word added... Obviously, its size was < 20 bytes so NGINX didn't apply gzip on it.



    So I just added gzip_min_length 0; to the nginx.conf - and all works now.






    share|improve this answer


























      up vote
      2
      down vote













      OK, that was simple - but I wasted a lot of time trying to figure it out. Maybe will be helpful for somebody else.



      Everything was good with configs, but let's take a look on to the documentation:




      Syntax: gzip_min_length length;
      Default: gzip_min_length 20;




      And guess what? I tested it with index.html with one word added... Obviously, its size was < 20 bytes so NGINX didn't apply gzip on it.



      So I just added gzip_min_length 0; to the nginx.conf - and all works now.






      share|improve this answer
























        up vote
        2
        down vote










        up vote
        2
        down vote









        OK, that was simple - but I wasted a lot of time trying to figure it out. Maybe will be helpful for somebody else.



        Everything was good with configs, but let's take a look on to the documentation:




        Syntax: gzip_min_length length;
        Default: gzip_min_length 20;




        And guess what? I tested it with index.html with one word added... Obviously, its size was < 20 bytes so NGINX didn't apply gzip on it.



        So I just added gzip_min_length 0; to the nginx.conf - and all works now.






        share|improve this answer














        OK, that was simple - but I wasted a lot of time trying to figure it out. Maybe will be helpful for somebody else.



        Everything was good with configs, but let's take a look on to the documentation:




        Syntax: gzip_min_length length;
        Default: gzip_min_length 20;




        And guess what? I tested it with index.html with one word added... Obviously, its size was < 20 bytes so NGINX didn't apply gzip on it.



        So I just added gzip_min_length 0; to the nginx.conf - and all works now.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Sep 24 at 12:45

























        answered Sep 20 at 9:41









        setevoy

        5141823




        5141823



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f470034%2fnginx-gzip-per-virtualhost%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Bahrain

            Postfix configuration issue with fips on centos 7; mailgun relay