Валентин Бартенев
December 26, 2012 07:02AM
On Wednesday 26 December 2012 15:39:12 dwow wrote:
> А что у вас покажут вот эти две команды при вашей конфигурации?
>
> curl -i localhost:8000/
> curl -i localhost:8000/ -H "Accept-Encoding: gzip"
>

Из-за лишнего слеша в try_files покажет 500-ую в обоих случаях,
но если слегка исправить:

events { }

http {
default_type text/html;
types {}

server {
listen 8000;

location / {
try_files $uri "${uri}test.html";

gunzip on;
gzip_vary on;
gzip_static always;
}

location = /test.html {
gunzip on;
gzip_vary on;
gzip_static always;
}
}
}


% curl -i localhost:8000/
HTTP/1.1 200 OK
Server: nginx/1.3.11
Date: Wed, 26 Dec 2012 11:51:36 GMT
Content-Type: text/html
Last-Modified: Wed, 26 Dec 2012 11:21:46 GMT
Transfer-Encoding: chunked
Connection: keep-alive
Vary: Accept-Encoding

GOOD
% curl -i localhost:8000/ -H "Accept-Encoding: gzip"
HTTP/1.1 200 OK
Server: nginx/1.3.11
Date: Wed, 26 Dec 2012 11:51:39 GMT
Content-Type: text/html
Content-Length: 35
Last-Modified: Wed, 26 Dec 2012 11:21:46 GMT
Connection: keep-alive
Vary: Accept-Encoding
ETag: "50daddca-23"
Content-Encoding: gzip

���Ptest.htmls��w�͒��%


Чтобы избежать появления 500-ой ошибки при других несуществующих запросах,
лучше переписать конфигурацию так:

location / {
try_files $uri /test.html;

gunzip on;
gzip_vary on;
gzip_static always;
}

location = /test.html {
gunzip on;
gzip_vary on;
gzip_static always;
}

если функциональность индекса нужна во множестве директорий, то так:

location / {
try_files $uri "${uri}test.html";

gunzip on;
gzip_vary on;
gzip_static always;
}

location ~ /test\.html$ {
gunzip on;
gzip_vary on;
gzip_static always;
}

--
Валентин Бартенев
http://nginx.com/support.html
http://nginx.org/en/donation.html
_______________________________________________
nginx-ru mailing list
nginx-ru@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-ru
Subject Author Posted

http_gunzip_module

dwow November 12, 2012 01:03PM

Re: http_gunzip_module

Maxim Dounin November 12, 2012 01:32PM

Re: http_gunzip_module

dwow November 13, 2012 01:56AM

Re: http_gunzip_module

dwow November 13, 2012 04:33AM

Re: http_gunzip_module

Maxim Dounin November 13, 2012 05:18AM

Re: http_gunzip_module

dwow November 13, 2012 12:21PM

Re: http_gunzip_module

Maxim Dounin November 13, 2012 12:48PM

Re: http_gunzip_module

dwow November 13, 2012 02:30PM

Re: http_gunzip_module

Валентин Бартенев November 13, 2012 02:34PM

Re: http_gunzip_module

dwow November 14, 2012 02:45AM

Re: http_gunzip_module

dwow December 24, 2012 02:49PM

Re: http_gunzip_module

Валентин Бартенев December 24, 2012 03:02PM

Re: http_gunzip_module

dwow December 24, 2012 03:09PM

Re: http_gunzip_module

Валентин Бартенев December 24, 2012 05:18PM

Re: http_gunzip_module

dwow December 24, 2012 11:04PM

Re: http_gunzip_module

dwow December 25, 2012 02:30AM

Re: http_gunzip_module

Валентин Бартенев December 25, 2012 04:04AM

Re: http_gunzip_module

dwow December 25, 2012 04:12AM

Re: http_gunzip_module

dwow December 26, 2012 05:43AM

Re: http_gunzip_module

Валентин Бартенев December 26, 2012 06:32AM

Re: http_gunzip_module

dwow December 26, 2012 06:39AM

Re: http_gunzip_module

Валентин Бартенев December 26, 2012 07:02AM

Re: http_gunzip_module

dwow December 27, 2012 05:55AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 306
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready