About
Tool No. 62 of Pikkola
A server block is short, and its mistakes are quiet. A missing semicolon is loud, since nginx refuses the file, but an old protocol or a Host header left behind starts cleanly and breaks a password reset three weeks later. This page writes one block from a few choices, then reads any config back and names the lines worth changing.
What it does
- Writes a whole nginx.conf from seven presets: a proxy to Node, Python or Go, a React or Vue build served from disk, a WebSocket upgrade, and old names that answer 301.
- Adds TLS 1.2 and 1.3 with a certificate pair and HTTP/2, HSTS, gzip or brotli, a rate limit with a zone, security headers, and a static cache that keeps index.html fresh.
- Copies the file, downloads it as nginx.conf, and prints the test and reload command.
- Parses a pasted config the way nginx does, tokens and braces first, then thirty checks over the tree it built.
- Reports each finding with a line number, a severity and a sentence about what it costs.
- English, Korean and Japanese, a light and a dark theme, and a phone layout that does not scroll sideways.
What each preset writes
The three proxy presets differ in one line, the upstream: 127.0.0.1:3000 for Node, 8000 for Gunicorn, 8080 for Go. All three set Host, X-Real-IP, X-Forwarded-For and X-Forwarded-Proto, use HTTP/1.1 to the app so keepalive works, and close the read after sixty seconds.
The two build presets serve a directory. index.html is the index, an unknown path falls back to it, and a request for index.html itself is marked to expire at once, because a cached shell pins every visitor to the build they first loaded. Assets get a year, matched by extension, and a file that is not there answers 404 rather than the shell.
The WebSocket preset adds a map from $http_upgrade to a connection value, then sends Upgrade and Connection from that map instead of a fixed string. A fixed upgrade would hold an idle socket open for every ordinary request too, and the read timeout goes to an hour.
The redirect preset writes a second server that lists the old names and returns 301 with the path kept, so a link to a deep page lands on the same page under the new name.
Why the file is a whole nginx.conf
Two directives this page writes cannot live inside a server block: limit_req_zone and map belong to the http context. A server block on its own would fail to load with either one in it, and a reader would have to work out where to move them. So the file carries the http block too, with a comment at the top saying which lines belong there and which belong in conf.d.
What the switches add
| Switch | Lines | Leave it off when |
| TLS | ssl_protocols, session cache, the certificate pair, http2, a port 80 redirect | Something in front already ends TLS, or the host has no certificate yet |
| HSTS | One add_header with a two year max-age | The domain is still being tried on plain http, since a browser remembers the header |
| gzip | A level, a minimum length, vary, and the types | The app compresses its own responses, which would double the work |
| Brotli | The same shape with brotli_types | The nginx build has no ngx_brotli module |
| Rate limit | A zone in http, limit_req in the location, 429 as the status | A crawler or a webhook has to be answered without a ceiling |
| Security headers | CSP, nosniff, frame and referrer rules | The app sends its own policy, since two would intersect |
| Static cache | expires by extension, and index.html at once | The site is proxied, so the app decides its own cache headers |
| SPA fallback | try_files with index.html last | The app serves real pages that should answer 404 |
How the linter reads
It tokenises the text: words, semicolons, braces, with comments dropped and quoted strings and ${variables} kept whole. Then it builds the tree nginx would build, and every finding carries the line of the token that caused it. A missing semicolon is found by the word that swallowed the next directive, which is why the report points one line above the line you would guess.
The thirty checks fall into six groups: braces and semicolons, TLS, the proxy, response headers, files and paths, and limits. A severity of fail means nginx refuses the file or serves traffic that a browser treats as broken. Warn means the file loads and the damage is quiet. Info is a line worth a second look.
What it cannot know: whether the file loads on your build of nginx, whether a module is present, what an included file contains, whether the upstream answers, or whether the certificate covers the name. nginx -t remains the test, and it runs on the host, not here.
What it deliberately does not do
- It does not connect to a server, send a request, or deploy the file for you.
- It does not issue or install a certificate, and it does not guess whether yours is valid.
- It does not read includes: a file pasted without its conf.d fragments is judged on what it shows.
- It does not collect analytics, set cookies, or load a font or a script from another host.
Why it is free
A static page that computes in the browser costs almost nothing to serve, so there is no reason to charge for it. Pikkola builds small tools that do one job and keeps them free, with no account and no advertising.
Contact
A preset that should exist, a check that is wrong about a directive, a finding that is missing: hello@pikkola.com. Send the config you pasted and the line you disagree with.
소개
피콜라의 62번째 도구
서버 블록은 짧고, 그 안의 실수는 조용합니다. 세미콜론이 빠지면 nginx가 파일을 거부하니 시끄럽지만, 오래된 프로토콜이나 빠뜨린 Host 헤더는 아무 일 없이 시작해서 몇 주 뒤 비밀번호 재설정을 깨뜨립니다. 이 페이지는 몇 가지 선택으로 블록 하나를 쓰고, 붙여 넣은 설정을 다시 읽어 손볼 줄을 짚습니다.
하는 일
- 프리셋 일곱 가지로 nginx.conf 한 장을 씁니다. Node, 파이썬, Go 리버스 프록시, 디스크에 놓인 React와 Vue 빌드, 웹소켓 업그레이드, 301로 답하는 옛 도메인입니다.
- TLS 1.2와 1.3에 인증서 한 쌍과 HTTP/2, HSTS, gzip이나 brotli, 존을 둔 속도 제한, 보안 헤더, index.html은 새로 두는 정적 캐시를 더합니다.
- 파일을 복사하고 nginx.conf로 내려받게 하며, 검사와 재시작 명령을 함께 보여 줍니다.
- 붙여 넣은 설정을 nginx처럼 해석합니다. 먼저 단어와 중괄호, 그다음 만들어진 트리 위에서 서른 가지를 봅니다.
- 결과마다 줄 번호와 등급, 그리고 무엇을 잃는지 한 줄을 답니다.
- 영어, 한국어, 일본어와 밝은 테마, 어두운 테마, 옆으로 넘어가지 않는 휴대폰 화면까지.
프리셋마다 쓰는 것
프록시 프리셋 셋은 한 줄만 다릅니다. 업스트림입니다. Node는 127.0.0.1:3000, 구니콘은 8000, Go는 8080입니다. 셋 모두 Host, X-Real-IP, X-Forwarded-For, X-Forwarded-Proto를 넘기고, 앱과는 HTTP/1.1로 말해 keepalive가 살아 있게 하고, 읽기는 60초에서 닫습니다.
빌드 프리셋 둘은 디렉터리를 내보냅니다. index.html이 인덱스이고, 모르는 경로는 그리로 돌아가며, index.html 자체는 곧바로 만료되게 둡니다. 캐시된 껍데기는 방문자를 처음 받은 빌드에 붙잡아 두기 때문입니다. 에셋은 확장자로 잡아 1년을 주고, 없는 파일은 껍데기 대신 404로 답합니다.
웹소켓 프리셋은 $http_upgrade에서 연결 값으로 가는 map을 하나 더하고, Upgrade와 Connection을 고정 문자열이 아니라 그 map에서 보냅니다. 고정 upgrade는 평범한 요청에도 소켓을 붙잡아 두고, 읽기 제한은 한 시간으로 늘어납니다.
리다이렉트 프리셋은 옛 이름을 나열하고 경로를 그대로 실어 301로 답하는 서버를 하나 더 씁니다. 깊은 페이지로 가던 링크가 새 이름 아래 같은 페이지에 닿습니다.
파일이 nginx.conf 한 장인 이유
이 페이지가 쓰는 지시자 둘은 서버 블록 안에 살 수 없습니다. limit_req_zone과 map은 http 문맥의 것입니다. 서버 블록만 내주면 그중 하나가 들어 있는 순간 파일이 열리지 않고, 읽는 사람이 어디로 옮겨야 하는지 스스로 알아내야 합니다. 그래서 파일은 http 블록까지 들고 나가고, 맨 위 주석이 어느 줄이 그쪽에 가고 어느 줄이 conf.d로 가는지 적습니다.
스위치가 더하는 것
| 스위치 | 줄 | 끄는 편이 나을 때 |
| TLS | ssl_protocols, 세션 캐시, 인증서 한 쌍, http2, 80번 리다이렉트 | 앞단이 이미 TLS를 끝내거나, 아직 인증서가 없을 때 |
| HSTS | 2년 max-age를 담은 add_header 한 줄 | 아직 평문 http로도 시험 중일 때. 브라우저는 이 헤더를 기억합니다 |
| gzip | 압축 수준, 최소 길이, vary, 타입 목록 | 앱이 직접 압축할 때. 두 번 하면 일만 늘어납니다 |
| Brotli | 같은 모양에 brotli_types | nginx 빌드에 ngx_brotli 모듈이 없을 때 |
| 속도 제한 | http의 존, location의 limit_req, 상태 코드 429 | 크롤러나 웹훅은 상한 없이 받아야 할 때 |
| 보안 헤더 | CSP, nosniff, 프레임과 리퍼러 규칙 | 앱이 자기 정책을 보낼 때. 둘이 겹치면 교집합이 됩니다 |
| 정적 캐시 | 확장자별 expires, 그리고 index.html은 즉시 | 프록시 사이트라 앱이 캐시 헤더를 정할 때 |
| SPA 폴백 | index.html을 마지막에 두는 try_files | 앱이 진짜 404를 내야 하는 페이지를 서비스할 때 |
검사기가 읽는 방법
글을 토큰으로 나눕니다. 단어, 세미콜론, 중괄호이고, 주석은 버리고 따옴표 문자열과 ${} 변수는 통째로 둡니다. 그다음 nginx가 만들 트리를 만들고, 결과마다 원인이 된 토큰의 줄을 답니다. 세미콜론 누락은 다음 지시자를 삼킨 단어가 잡아내므로, 보고는 짐작하는 줄보다 한 줄 위를 가리킵니다.
서른 가지 검사는 여섯 갈래입니다. 중괄호와 세미콜론, TLS, 프록시, 응답 헤더, 파일과 경로, 제한입니다. 실패는 nginx가 파일을 거부하거나 브라우저가 망가진 것으로 보는 트래픽을 내보내는 줄입니다. 경고는 파일이 열리고 피해가 조용한 줄입니다. 정보는 한 번 더 볼 만한 줄입니다.
알 수 없는 것도 있습니다. 당신의 nginx 빌드에서 파일이 열리는지, 모듈이 있는지, include한 파일에 무엇이 들었는지, 업스트림이 답하는지, 인증서가 그 이름을 덮는지입니다. 여전히 nginx -t가 시험이고, 그것은 이 페이지가 아니라 서버에서 돕니다.
일부러 하지 않는 것
- 서버에 접속하지도, 요청을 보내지도, 파일을 대신 배포하지도 않습니다.
- 인증서를 발급하거나 설치하지 않고, 당신의 인증서가 유효한지 짐작하지 않습니다.
- include를 읽지 않습니다. conf.d 조각 없이 붙여 넣은 파일은 보이는 것만으로 판정합니다.
- 분석도, 쿠키도 없고, 다른 호스트의 폰트나 스크립트도 불러오지 않습니다.
왜 무료인가
브라우저에서 계산하는 정적 페이지는 띄우는 비용이 거의 들지 않으니 값을 받을 이유도 없습니다. 피콜라는 일 하나를 맡은 작은 도구를 만들고 무료로 둡니다. 계정도 광고도 없습니다.
연락
있어야 할 프리셋, 어떤 지시자에 대해 틀린 검사, 빠진 결과가 있다면 hello@pikkola.com으로 알려 주세요. 붙여 넣은 설정과 동의하지 않는 줄을 함께 적어 주시면 좋습니다.
概要
Pikkola の 62 番目のツール
サーバーブロックは短く、その誤りは静かです。セミコロンが欠ければ nginx がファイルを拒むので騒がしくなりますが、古いプロトコルや抜けた Host ヘッダーは何事もなく起動し、数週間後にパスワード再設定を壊します。このページはいくつかの選択からブロックを一つ書き、貼り付けた設定を読み返して直すべき行を示します。
できること
- 七つのプリセットから nginx.conf 一枚を書きます。Node、Python、Go へのプロキシ、ディスク上の React と Vue のビルド、WebSocket のアップグレード、301 で答える古い名前です。
- TLS 1.2 と 1.3、証明書の組と HTTP/2、HSTS、gzip か brotli、ゾーンを持つ速度制限、保安ヘッダー、index.html を新しく保つ静的キャッシュを加えます。
- ファイルをコピーし、nginx.conf として保存させ、検査と再読み込みの命令を並べます。
- 貼り付けた設定を nginx のように解きます。まず語と中括弧、次に出来た木の上で三十件を調べます。
- 指摘ごとに行番号と段階、そして何を失うかの一文を付けます。
- 英語、韓国語、日本語、明るいテーマと暗いテーマ、横に流れない携帯の画面。
プリセットが書くもの
プロキシの三つは一行だけ違います。上流です。Node は 127.0.0.1:3000、Gunicorn は 8000、Go は 8080 です。どれも Host、X-Real-IP、X-Forwarded-For、X-Forwarded-Proto を渡し、アプリとは HTTP/1.1 で話して keepalive を生かし、読み取りは六十秒で閉じます。
ビルドの二つはディレクトリを配ります。index.html が索引で、知らない経路はそこへ戻り、index.html 自体はすぐに期限切れにします。保たれた殻は訪問者を最初に受け取ったビルドへ縛り付けるからです。資産は拡張子で一年を与え、無いファイルは殻ではなく 404 で答えます。
WebSocket のプリセットは $http_upgrade から接続値への map を一つ加え、Upgrade と Connection を固定の文字列ではなくその map から送ります。固定の upgrade は普通の要求にもソケットを握らせ、読み取りの制限は一時間になります。
転送のプリセットは、古い名前を並べ経路をそのまま載せて 301 で答えるサーバーをもう一つ書きます。深いページへのリンクが、新しい名前の下の同じページに着きます。
ファイルが nginx.conf 一枚である理由
このページが書く指令のうち二つは、サーバーブロックの中に置けません。limit_req_zone と map は http の文脈のものです。サーバーブロックだけを渡すと、どちらかが入った瞬間にファイルは読めず、読む人がどこへ移すかを自分で判断することになります。だからファイルは http ブロックも持ち、先頭の注記がどの行がそちらへ、どの行が conf.d へ行くかを書いています。
スイッチが加えるもの
| スイッチ | 行 | 切ったほうがよいとき |
| TLS | ssl_protocols、セッションのキャッシュ、証明書の組、http2、80 番の転送 | 手前がすでに TLS を終える、または証明書がまだ無いとき |
| HSTS | 二年の max-age を持つ add_header 一行 | まだ平文の http でも試しているとき。ブラウザーはこのヘッダーを覚えます |
| gzip | 圧縮の段階、最小の長さ、vary、種の一覧 | アプリが自分で圧縮するとき。二度すると手間が増えるだけです |
| Brotli | 同じ形で brotli_types | nginx のビルドに ngx_brotli モジュールが無いとき |
| 速度制限 | http のゾーン、location の limit_req、状態 429 | 走査やウェブフックを上限無しで受ける必要があるとき |
| 保安ヘッダー | CSP、nosniff、枠とリファラーの規則 | アプリが自分の方針を送るとき。二つ重なれば積になります |
| 静的キャッシュ | 拡張子ごとの expires、index.html は即時 | プロキシのサイトで、アプリがキャッシュのヘッダーを決めるとき |
| SPA の代替 | index.html を最後に置く try_files | アプリが本当の 404 を返すページを持つとき |
検査器の読み方
文字を語、セミコロン、中括弧に分けます。注記は捨て、引用した文字列と ${} の変数はそのまま残します。次に nginx が作る木を作り、指摘ごとに原因の語の行を付けます。セミコロンの欠けは次の指令を飲み込んだ語が見つけるので、報告は想像する行より一つ上を指します。
三十件の検査は六つの組です。中括弧とセミコロン、TLS、プロキシ、応答ヘッダー、ファイルと経路、制限です。失敗は nginx がファイルを拒むか、ブラウザーが壊れたものとして扱う通信を出す行です。警告は読み込まれ、損が静かな行です。情報はもう一度見る価値のある行です。
分からないこともあります。あなたの nginx のビルドで読み込めるか、モジュールがあるか、include したファイルに何があるか、上流が答えるか、証明書がその名前を覆うかです。やはり nginx -t が試験で、それはこのページではなくサーバーで走ります。
意図してしないこと
- サーバーへ接続せず、要求を送らず、ファイルを代わりに配備しません。
- 証明書を発行も設置もせず、あなたの証明書が正しいかを推測しません。
- include を読みません。conf.d の断片なしで貼られたファイルは、見えているものだけで判定します。
- 分析も、クッキーも無く、別のホストのフォントやスクリプトも読みません。
なぜ無料か
ブラウザーで計算する静的なページは、置く費用がほとんど掛からないので値段を取る理由もありません。Pikkola は一つの仕事を担う小さな道具を作り、無料で置きます。アカウントも広告もありません。
連絡
あるべきプリセット、ある指令について違う検査、抜けている指摘があれば hello@pikkola.com まで。貼った設定と、納得できない行を添えてください。