<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Nginx on 高木のブログ</title>
    <link>https://takagi.blog/tags/nginx/</link>
    <description>Recent content in Nginx on 高木のブログ</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>ja-jp</language>
    <lastBuildDate>Fri, 25 Feb 2022 00:00:00 +0000</lastBuildDate><atom:link href="https://takagi.blog/tags/nginx/rss.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>【nginx】ステータスコード「444」</title>
      <link>https://takagi.blog/nginx-http-status-code-444/</link>
      <pubDate>Fri, 25 Feb 2022 00:00:00 +0000</pubDate>
      
      <guid>https://takagi.blog/nginx-http-status-code-444/</guid>
      <description>&lt;p&gt;nginx でステータスコード「444」を返すコードを見掛けて、なんぞや！って思って調べた&lt;/p&gt;
&lt;p&gt;nginx の独自のステータスコードで、何も返さないでコネクションを閉じる&lt;br&gt;
悪意のあるボットからのアクセスを遮断する時などに使ったりするらしい&lt;/p&gt;
&lt;h2 id=&#34;動作確認&#34;&gt;動作確認 &lt;a href=&#34;#%e5%8b%95%e4%bd%9c%e7%a2%ba%e8%aa%8d&#34; class=&#34;anchor&#34;&gt;🔗&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Dockerで環境を作って試してみた&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/ytkg/nginx-http-status-code-444&#34; target=&#34;_blank&#34;&gt;&lt;img src=&#34;https://gh-card.dev/repos/ytkg/nginx-http-status-code-444.svg&#34; alt=&#34;ytkg/nginx-http-status-code-444 - GitHub&#34;&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;/hoge へのアクセスに「444」を返す設定を記述した&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-nginx:title=nginx.conf&#34; data-lang=&#34;nginx:title=nginx.conf&#34;&gt;server {
    listen       80;
    listen  [::]:80;
    server_name  localhost;

    location / {
        root   /usr/share/nginx/html;
        index  index.html index.htm;
    }

    location = /hoge {
        return 444;
    }
}
&lt;/code&gt;&lt;/pre&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;$ curl localhost:8080/hoge
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;curl: &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;52&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt; Empty reply from server
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;サーバーから何も返ってこなかった&lt;/p&gt;
&lt;h2 id=&#34;参考&#34;&gt;参考 &lt;a href=&#34;#%e5%8f%82%e8%80%83&#34; class=&#34;anchor&#34;&gt;🔗&lt;/a&gt;&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://kyotrail.com/?p=15&#34; target=&#34;_blank&#34;&gt;悪意あるbotのアクセスを9割遮断する簡単な方法 NGINX  |  Masaki MTB Blog&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://blog.denet.co.jp/nginxipfilter/&#34; target=&#34;_blank&#34;&gt;nginxでIPフィルタを設定した上で無許可IPにはステータスコードを返さない - DENET 技術ブログ&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
</description>
    </item>
    
  </channel>
</rss>
