java, c# , linux, program devloper: nginx 카테고리 글 목록
http://blog1.phps.kr/
blog.visualp.com
2021-05-29T01:04:30+09:00
Textcube 1.10.7 : Tempo primo
Robots.txt disallow all with nginx nignx에서 웹사이트 로봇접근 방지
java, tomcat, c#
http://blog1.phps.kr/754
2019-04-23T18:31:36+09:00
2019-04-23T18:29:46+09:00
<span class="hljs-attribute">location</span> = /robots.txt {<br /> <span class="hljs-attribute">add_header</span> Content-Type text/plain;<br /> <span class="hljs-attribute">return</span> <span class="hljs-number">200</span> <span class="hljs-string">"User-agent: *\nDisallow: /\n"</span>;<br />}<br /><br />[원문]https://alan.ivey.dev/posts/2017/robots.txt-disallow-all-with-nginx/<br />[참고]https://serverfault.com/questions/549332/how-to-set-robots-txt-globally-in-nginx-for-all-virtual-hosts<br />[참고]https://edykim.com/ko/post/overwrite-robots.txt-with-nginx-settings/<p><strong><a href="http://blog1.phps.kr/754?commentInput=true#entry754WriteComment">댓글 쓰기</a></strong></p>
nginx allow ip address, deny ip address
java, tomcat, c#
http://blog1.phps.kr/728
2018-01-03T10:21:05+09:00
2018-01-03T10:21:03+09:00
[참고]http://nginx.org/en/docs/http/ngx_http_access_module.html<br /><br />특정 아이피를 지정 하여 허용하려면 <br />allow 192.168.1.20<br />allow 192.168.1.0/24;<br />allow 10.1.1.0/16;<br />allow 2001:0db8::/32;<br />등등 다음과 같이 허용할 아이피 또는 아이피 대역대를 설정 하고<br />deny all;<br />를 설정하면 ... 허용된 아이피를 제외한 모든 아이피가 차단된다.<br /><br />[Example]<br />location / {<br /> deny 192.168.1.1;<br /> allow 192.168.1.0/24;<br /> allow 10.1.1.0/16;<br /> allow 2001:0db8::/32;<br /> deny all;<br />}<br /><br />The rules are checked in sequence until the first match is found. In this example, access is allowed only for IPv4 networks <code>10.1.1.0/16</code> and <code>192.168.1.0/24</code> excluding the address <code>192.168.1.1</code>, and for IPv6 network <code>2001:0db8::/32</code>. In case of a lot of rules, the use of the <a href="http://nginx.org/en/docs/http/ngx_http_geo_module.html">ngx_http_geo_module</a> module variables is preferable. <a name="directives"></a><center>
<h4>Directives</h4>
</center><a name="allow"></a>
<div class="directive">
<table cellspacing="0">
<tbody>
<tr><th>Syntax:</th>
<td><code><strong>allow</strong> <code><em>address</em></code> | <code><em>CIDR</em></code> | <code>unix:</code> | <code>all</code>;</code></td>
</tr>
<tr><th>Default:</th>
<td>—</td>
</tr>
<tr><th>Context:</th>
<td><code>http</code>, <code>server</code>, <code>location</code>, <code>limit_except</code></td>
</tr>
</tbody>
</table>
</div>
<p>Allows access for the specified network or address. If the special value <code>unix:</code> is specified (1.5.1), allows access for all UNIX-domain sockets.</p>
<a name="deny"></a>
<div class="directive">
<table cellspacing="0">
<tbody>
<tr><th>Syntax:</th>
<td><code><strong>deny</strong> <code><em>address</em></code> | <code><em>CIDR</em></code> | <code>unix:</code> | <code>all</code>;</code></td>
</tr>
<tr><th>Default:</th>
<td>—</td>
</tr>
<tr><th>Context:</th>
<td><code>http</code>, <code>server</code>, <code>location</code>, <code>limit_except</code></td>
</tr>
</tbody>
</table>
</div>
<p>Denies access for the specified network or address. If the special value <code>unix:</code> is specified (1.5.1), denies access for all UNIX-domain sockets.</p><p><strong><a href="http://blog1.phps.kr/728?commentInput=true#entry728WriteComment">댓글 쓰기</a></strong></p>
nginx 외부링크 차단
java, tomcat, c#
http://blog1.phps.kr/716
2016-12-02T14:23:50+09:00
2016-12-02T14:23:46+09:00
<div class="crayon-pre" style="line-height: 15px !important; font-size: 12px !important; tab-size: 4; -moz-tab-size: 4; -o-tab-size: 4; -webkit-tab-size: 4;">
<div id="crayon-5841051c9877c031670264-1" class="crayon-line"><span class="crayon-v"><span class="crayon-v"><br /></span></span>
<h3>이미지 외부링크 차단하기</h3>
<p>이미지 외부링크 차단하기 에 대한 설명이며<br />Nginx 기준입니다.<br />nginx.conf file에 아래의 정보를 추가하시면 됩니다.<br /><br /><br /></p>
<p><span class="crayon-o">localtion ~</span><span class="crayon-sy">\</span><span class="crayon-sy">.</span><span class="crayon-sy">(</span><span class="crayon-v">jpg</span><span class="crayon-sy">?</span><span class="crayon-v">g</span><span class="crayon-o">|</span><span class="crayon-v">png</span><span class="crayon-o">|</span><span class="crayon-v">gif</span><span class="crayon-sy">)</span><span class="crayon-sy">$</span><span class="crayon-sy">{</span></p>
</div>
<div id="crayon-5841051c9877c031670264-2" class="crayon-line crayon-striped-line"><span class="crayon-h"> </span><span class="crayon-e">valid_referers </span><span class="crayon-e">none </span><span class="crayon-e">blocked </span><span class="crayon-v">domain</span><span class="crayon-e">.com</span><span class="crayon-o">*</span><span class="crayon-e">.domain</span><span class="crayon-e">.com</span><span class="crayon-sy">;</span></div>
<div id="crayon-5841051c9877c031670264-3" class="crayon-line"><span class="crayon-h"> </span><span class="crayon-st">if</span><span class="crayon-sy">(</span><span class="crayon-v">$invalid_referer</span><span class="crayon-sy">)</span><span class="crayon-sy">{</span></div>
<div id="crayon-5841051c9877c031670264-4" class="crayon-line crayon-striped-line"><span class="crayon-h"> </span><span class="crayon-st">return</span><span class="crayon-cn">403</span><span class="crayon-sy">;</span></div>
<div id="crayon-5841051c9877c031670264-5" class="crayon-line"><span class="crayon-h"> </span><span class="crayon-sy">}</span></div>
<div id="crayon-5841051c9877c031670264-6" class="crayon-line crayon-striped-line"><span class="crayon-sy">}<br /></span></div>
</div><p><strong><a href="http://blog1.phps.kr/716?commentInput=true#entry716WriteComment">댓글 쓰기</a></strong></p>
nginx - errorlog - upstream response is buffered to a temporary file /var/cache/nginx/proxy
java, tomcat, c#
http://blog1.phps.kr/706
2016-02-24T09:54:06+09:00
2016-02-24T09:54:03+09:00
다음과 같은 오류가 발생한다면, 버퍼 사이즈를 nginx에 설정 해줘야한다.<br /><br />20xx/xx/xx xx:xx:xx [warn] ….an upstream response is buffered to a temporary file /var/cache/nginx/proxy_temp/xxxx while readi<br /> ng upstream, client: xxx.xxx.xxx.xxx, server: aaa.aaaa.aaa.com, request: “GET /font/NanumGothic-Regular.woff HTTP/1.1”, upstream: “http:<br /> //127.0.0.1:111/font/NanumGothic-ExtraBold.eot”,<br /><br />http, location , server 중 아무데나 아래 값 추가 할 수 있음.<br />location에 추가함 .<br /><br /><span class="crayon-e">proxy_buffering </span><span class="crayon-v">on</span><span class="crayon-sy">;</span>
<div id="crayon-56ccfdb8221c7257595316-3" class="crayon-line"><span class="crayon-v">proxy_buffer</span><span class="crayon-sy">_</span>size<span class="crayon-h"> </span><span class="crayon-cn">1024k</span><span class="crayon-sy">;</span></div>
<div id="crayon-56ccfdb8221c7257595316-4" class="crayon-line crayon-striped-line"><span class="crayon-v">proxy</span><span class="crayon-sy">_</span>buffers<span class="crayon-h"> </span><span class="crayon-cn">1024</span><span class="crayon-h"> </span><span class="crayon-cn">1024k</span><span class="crayon-sy">;</span></div>
<div id="crayon-56ccfdb8221c7257595316-5" class="crayon-line"><span class="crayon-v">client_body_buffer</span><span class="crayon-sy">_</span>size<span class="crayon-cn">1024k</span><span class="crayon-sy">;</span></div>
<div id="crayon-56ccfdb8221c7257595316-6" class="crayon-line crayon-striped-line"><span class="crayon-v">proxy_busy_buffers</span><span class="crayon-sy">_</span>size<span class="crayon-cn">1024k</span><span class="crayon-sy">;</span></div><p><strong><a href="http://blog1.phps.kr/706?commentInput=true#entry706WriteComment">댓글 쓰기</a></strong></p>