문서의 이전 판입니다!
응답으로 오는 Server 헤더에 nginx 정보가 들어간다. 이를 숨기는 것이 좋다.
server_tokens off
send_timeout 60s; # 요청을 보낸 후 응답을 받기까지 대기 시간. 이 설정상 최소 60초 이내에 응답이 와야한다.
error_page 404 /404.html; error_page 502 503 504 /50x.html; error_page 403 http://example.com/forbidden.html; error_page 404 = @fetch; # 응답코드 바꿔치기 error_page 404 =200 /empty.gif; error_page 404 =403 /forbidden.gif;
expires epoch;
: 캐시 끄기expires max;
31 December 2037 23:59:59 GMT, Cache-Control max-age to 10 years. expires 24h; expires modified +24h; expires @15h30m; expires 0; expires -1; expires epoch; add_header Cache-Control private;
keepalive_timeout
을 통해서 값을 조정한다. 이를 0
으로 하면 keepalive가 꺼진다.keepalive_timeout 0;
keepalive
는 성능에 중요한 영향을 끼친다. nginx Performance 참조.Content-Type
)을 지정하고자 할 때.# charset_types 에 charset을 자동으로 붙여줄 mime type들 추가. text/html은 지정하지 말 것. charset_types text/xml text/plain text/css application/javascript application/x-javascript application/rss+xml; charset UTF-8;