0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

nginxのserver_tokensディレクティブ

Posted at

server_tokensとは、エラーページと "Server "レスポンスヘッダフィールドにnginxのバージョンを表示するかどうかを設定するディレクティブ
デフォルトはonなのでnginxのバージョンが表示される。

↓デフォルト

$ curl localhost -I
HTTP/1.1 200 OK
Server: nginx/1.14.1 * これ
Date: Fri, 11 Dec 2020 14:07:20 GMT
Content-Type: text/html
Content-Length: 4057
Last-Modified: Mon, 07 Oct 2019 21:16:24 GMT
Connection: keep-alive
ETag: "5d9bab28-fd9"
Accept-Ranges: bytes

↓offにする。nginxのバージョン情報が消える。

nginx.conf
server_tokens off;
$ curl localhost -I
HTTP/1.1 200 OK
Server: nginx
Date: Fri, 11 Dec 2020 14:10:54 GMT
Content-Type: text/html
Content-Length: 4057
Last-Modified: Mon, 07 Oct 2019 21:16:24 GMT
Connection: keep-alive
ETag: "5d9bab28-fd9"
Accept-Ranges: bytes
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?