Posted
Filed under nginx
location = /robots.txt {
  add_header  Content-Type  text/plain;
  return 200 "User-agent: *\nDisallow: /\n";
}

[원문]https://alan.ivey.dev/posts/2017/robots.txt-disallow-all-with-nginx/
[참고]https://serverfault.com/questions/549332/how-to-set-robots-txt-globally-in-nginx-for-all-virtual-hosts
[참고]https://edykim.com/ko/post/overwrite-robots.txt-with-nginx-settings/
2019/04/23 18:29 2019/04/23 18:29
Posted
Filed under nginx
[참고]http://nginx.org/en/docs/http/ngx_http_access_module.html

특정 아이피를 지정 하여 허용하려면
allow 192.168.1.20
allow 192.168.1.0/24;
allow 10.1.1.0/16;
allow 2001:0db8::/32;
등등 다음과 같이 허용할 아이피 또는 아이피 대역대를 설정 하고
deny  all;
를 설정하면 ... 허용된 아이피를 제외한 모든 아이피가 차단된다.

[Example]
location / {
    deny  192.168.1.1;
    allow 192.168.1.0/24;
    allow 10.1.1.0/16;
    allow 2001:0db8::/32;
    deny  all;
}

The rules are checked in sequence until the first match is found. In this example, access is allowed only for IPv4 networks 10.1.1.0/16 and 192.168.1.0/24 excluding the address 192.168.1.1, and for IPv6 network 2001:0db8::/32. In case of a lot of rules, the use of the ngx_http_geo_module module variables is preferable.

Directives

Syntax: allow address | CIDR | unix: | all;
Default:
Context: http, server, location, limit_except

Allows access for the specified network or address. If the special value unix: is specified (1.5.1), allows access for all UNIX-domain sockets.

Syntax: deny address | CIDR | unix: | all;
Default:
Context: http, server, location, limit_except

Denies access for the specified network or address. If the special value unix: is specified (1.5.1), denies access for all UNIX-domain sockets.

2018/01/03 10:21 2018/01/03 10:21
Posted
Filed under nginx

이미지 외부링크 차단하기

이미지 외부링크 차단하기 에 대한 설명이며
Nginx 기준입니다.
nginx.conf file에 아래의 정보를 추가하시면 됩니다.


localtion ~\.(jpg?g|png|gif)${

   valid_referers none blocked domain.com*.domain.com;
   if($invalid_referer){
       return403;
   }
}
2016/12/02 14:23 2016/12/02 14:23
Posted
Filed under nginx
다음과 같은 오류가 발생한다면, 버퍼 사이즈를 nginx에 설정 해줘야한다.

20xx/xx/xx xx:xx:xx [warn] ….an upstream response is buffered to a temporary file /var/cache/nginx/proxy_temp/xxxx while readi
ng upstream, client: xxx.xxx.xxx.xxx, server: aaa.aaaa.aaa.com, request: “GET /font/NanumGothic-Regular.woff HTTP/1.1”, upstream: “http:
//127.0.0.1:111/font/NanumGothic-ExtraBold.eot”,

http, location , server 중 아무데나 아래 값 추가 할 수 있음.
location에 추가함 .

proxy_buffering   on;
proxy_buffer_size    1024k;
proxy_buffers        1024   1024k;
client_body_buffer_size1024k;
proxy_busy_buffers_size1024k;
2016/02/24 09:54 2016/02/24 09:54