주 메뉴 열기

wwiki β

Nginx

Jhkim (토론 | 기여)님의 2019년 4월 20일 (토) 02:40 판

목차

보안설정

#/etc/nginx/nginx.conf

서버 버전 숨기기 등

http{
 
# 서버 버전 숨기기
server_tokens off; 
# 개발언어 숨기기
fastcgi_hide_header X-Powered-By;
proxy_hide_header X-Powered-By;
# http 프로토콜에서 xml 데이터를 전송하기위해 사용되는데, 특별한 용도가 없다면 막아두는것이 좋다.
fastcgi_hide_header X-Pingback;
proxy_hide_header X-Pingback;
#  xml 관련된 W3c 표준이긴한데, 특별한 용도가 없다면 막아두는것이 좋다.
fastcgi_hide_header Link;
proxy_hide_header X-Link;
 ...
}

첫 페이지 제거

location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                #try_files $uri $uri/ =404;
                return 404;
        }

특정url제거

location /share2 {

                return 404;
        }

에러페이지 제거

error_page 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 495 496 497 500 501 502 503 504 505 506 507 /error.html;

location = /error.html {

                internal;
}

error.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

"http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >

</head>

<body>

<center>

<br><h1>ERROR</h1>

</center>

</body>

</html>

해외아이피 차단

nginx 옵션 확인: --with-http_geoip_module=dynamic

에러

client intended to send too large body

server블록에 다음 추가

client_max_body_size 512M;

SSL routines:tls_process_client_hello:version too low

IE 6.0등 브라우저 버전이 낮은 경우에 발생한 보안에러이다.