Every HTTP Status Code You Need to Know
Every HTTP status code a beginner needs, each made for real on one server (Nginx in front of a small Flask app, tested with curl): what the first digit means, then 200, 201, 204, 301, 302, 304, 400, 401, 403, 404, 405, 409, 413, 422, 429, 500, 502, 503 and 504, with who sent each one (Nginx or your app) and what to check first.

Read a status code
Your site breaks. The log shows four HTTP status codes: 500, 502, 504, 503, each with a different fix. Here's every code you need.

Here's that log: the tail command prints its last lines, one per request. The number after each request is its status code.
sudo tail -n 8 /var/log/nginx/access.log172.18.0.3 - - [04/Dec/2026:22:16:10 +0000] "GET /notes HTTP/1.1" 429 178 "-" "curl/8.5.0" 172.18.0.3 - - [04/Dec/2026:22:16:11 +0000] "GET /notes HTTP/1.1" 429 178 "-" "curl/8.5.0" 172.18.0.3 - - [04/Dec/2026:22:16:18 +0000] "GET /notes/export HTTP/1.1" 500 265 "-" "curl/8.5.0" 172.18.0.3 - - [04/Dec/2026:22:16:22 +0000] "GET /notes HTTP/1.1" 502 166 "-" "curl/8.5.0" 172.18.0.3 - - [04/Dec/2026:22:16:27 +0000] "GET /notes HTTP/1.1" 200 64 "-" "curl/8.5.0" 172.18.0.3 - - [04/Dec/2026:22:16:35 +0000] "GET /notes/report HTTP/1.1" 504 176 "-" "curl/8.5.0" 172.18.0.3 - - [04/Dec/2026:22:16:40 +0000] "GET /notes HTTP/1.1" 503 206 "-" "curl/8.5.0" 172.18.0.3 - - [04/Dec/2026:22:16:43 +0000] "GET /notes HTTP/1.1" 200 64 "-" "curl/8.5.0"
Every answer to a request starts with a status line: the HTTP version, then the status code, three digits, then a few words for people.

Programs read only the number. Its first digit, from 1 to 5, says what kind of answer it is, and the rest says which one.

Think of a parcel you mail. The 200s: delivered. The 300s: they moved, here's the new address. The 400s: returned to sender, something's wrong with what you sent. The 500s: the post office itself failed.
Every test here runs on one real server. Your request reaches Nginx first: a web server that sits in front of your app. It serves plain files itself, and passes the rest to your app, a small Flask app. So some codes come from Nginx, and some from your app. When Nginx sends an error, its name is on the last line of the page.
It worked: 200, 201, 204
Even it worked comes in three kinds: you got something, you made something, or there's nothing to send back. Ask your app for your notes with curl, a tool that sends one request from the terminal. With -i, curl also shows the headers: short labelled lines about the answer. Below them is the body, your notes. 200 OK.
curl -i http://notes.test/notesHTTP/1.1 200 OK Server: nginx/1.24.0 (Ubuntu) Date: Fri, 04 Dec 2026 22:15:25 GMT Content-Type: application/json Content-Length: 64 Connection: keep-alive [{"id":1,"title":"buy milk"},{"id":2,"title":"renew passport"}]
Every request has a verb, called the method. Reading was GET. To create, curl's --json sends your note as JSON, a text format for data, and switches to POST. You get 201 Created, and the Location header says where to find it: /notes/3.
curl -i --json '{"title":"call the bank"}' http://notes.test/notesHTTP/1.1 201 CREATED Server: nginx/1.24.0 (Ubuntu) Date: Fri, 04 Dec 2026 22:15:26 GMT Content-Type: application/json Content-Length: 33 Connection: keep-alive Location: /notes/3 {"id":3,"title":"call the bank"}
Delete it: -X sets the method, here DELETE. The answer is 204 No Content: it worked, and there's nothing to send back. No body at all.
curl -i -X DELETE http://notes.test/notes/3HTTP/1.1 204 NO CONTENT Server: nginx/1.24.0 (Ubuntu) Date: Fri, 04 Dec 2026 22:15:28 GMT Content-Type: text/html; charset=utf-8 Connection: keep-alive
It moved: 301, 302, 307, 308
Ever typed an address and landed on a slightly different one? That's the 300s: they point somewhere else. Ask for /docs, without the slash at the end. Nginx answers 301 Moved Permanently, and the Location header gives the real address, with the slash. Browsers follow it on their own. curl follows it when you add -L: one 301, then 200.
curl -i http://notes.test/docsHTTP/1.1 301 Moved Permanently Server: nginx/1.24.0 (Ubuntu) Date: Fri, 04 Dec 2026 22:15:29 GMT Content-Type: text/html Content-Length: 178 Location: http://notes.test/docs/ Connection: keep-alive <html> <head><title>301 Moved Permanently</title></head> <body> <center><h1>301 Moved Permanently</h1></center> <hr><center>nginx/1.24.0 (Ubuntu)</center> </body> </html>
curl -iL http://notes.test/docsHTTP/1.1 301 Moved Permanently Server: nginx/1.24.0 (Ubuntu) Date: Fri, 04 Dec 2026 22:15:30 GMT Content-Type: text/html Content-Length: 178 Location: http://notes.test/docs/ Connection: keep-alive HTTP/1.1 200 OK Server: nginx/1.24.0 (Ubuntu) Date: Fri, 04 Dec 2026 22:15:30 GMT Content-Type: text/html Content-Length: 161 Last-Modified: Fri, 04 Dec 2026 22:07:17 GMT Connection: keep-alive ETag: "6b133995-a1" Accept-Ranges: bytes <!doctype html> <html><head><title>Notes API docs</title></head> <body><h1>Notes API</h1><p>GET /notes lists your notes. POST /notes adds one.</p></body></html>
302 Found is the temporary kind. Open your account page before you've logged in, and your app sends you to /login, for now. The account page itself hasn't moved.
curl -i http://notes.test/accountHTTP/1.1 302 FOUND Server: nginx/1.24.0 (Ubuntu) Date: Fri, 04 Dec 2026 22:15:32 GMT Content-Type: text/html; charset=utf-8 Content-Length: 199 Connection: keep-alive Location: /login <!doctype html> <html lang=en> <title>Redirecting...</title> <h1>Redirecting...</h1> <p>You should be redirected automatically to the target URL: <a href="/login">/login</a>. If not, click the link.
So 301 means moved for good, and 302 means for now. One catch: a browser following them may turn a POST into a GET, and your data isn't sent again. That happened so often that the standard added twins that keep the method: 308 for good, and 307 for now.

Nothing changed: 304
304 looks like an error, but it isn't. Ask Nginx for a file, app.js. A capital -I asks for the headers only. With them comes an ETag: a short tag for this exact version of the file.
curl -I http://notes.test/static/app.jsHTTP/1.1 200 OK Server: nginx/1.24.0 (Ubuntu) Date: Fri, 04 Dec 2026 22:15:33 GMT Content-Type: application/javascript Content-Length: 328 Last-Modified: Fri, 04 Dec 2026 22:07:17 GMT Connection: keep-alive ETag: "6b133995-148" Accept-Ranges: bytes
A browser keeps that tag. Next time, it sends it back: here's the version I have. curl does the same with -H, which adds a header: If-None-Match. Guess first: what comes back? 304 Not Modified, and no file at all. Your copy is still good, so nothing is sent again.
curl -I -H 'If-None-Match: "6b133995-148"' http://notes.test/static/app.jsHTTP/1.1 304 Not Modified Server: nginx/1.24.0 (Ubuntu) Date: Fri, 04 Dec 2026 22:15:34 GMT Last-Modified: Fri, 04 Dec 2026 22:07:17 GMT Connection: keep-alive ETag: "6b133995-148"
A broken request: 400
The 400s mean the request itself has a problem, so the fix is in what was sent, not in the server. 400 Bad Request: your app couldn't even read it. Here the JSON is missing its closing brace.
curl -i --json '{"title": "oops"' http://notes.test/notesHTTP/1.1 400 BAD REQUEST Server: nginx/1.24.0 (Ubuntu) Date: Fri, 04 Dec 2026 22:15:36 GMT Content-Type: text/html; charset=utf-8 Content-Length: 167 Connection: keep-alive <!doctype html> <html lang=en> <title>400 Bad Request</title> <h1>Bad Request</h1> <p>The browser (or proxy) sent a request that this server could not understand.</p>
Who are you? 401 and 403
401 and 403 get mixed up all the time. A token is the key that proves who you are. Ask for the admin stats without one, and you get 401 Unauthorized. Despite the name, it means: I don't know who you are. And a header in the answer says which kind of login it wants: a Bearer token.
curl -i http://notes.test/admin/statsHTTP/1.1 401 UNAUTHORIZED Server: nginx/1.24.0 (Ubuntu) Date: Fri, 04 Dec 2026 22:15:37 GMT Content-Type: application/json Content-Length: 25 Connection: keep-alive WWW-Authenticate: Bearer {"error":"log in first"}
Now send a valid token for a normal user: 403 Forbidden. The app knows exactly who you are, and the answer is still no. Logging in again won't help. You need permission.
curl -i -H 'Authorization: Bearer dev-token' http://notes.test/admin/statsHTTP/1.1 403 FORBIDDEN Server: nginx/1.24.0 (Ubuntu) Date: Fri, 04 Dec 2026 22:15:38 GMT Content-Type: application/json Content-Length: 24 Connection: keep-alive {"error":"admins only"}
Or, as the standard puts it: 401, prove who you are. 403, I know who you are, and no.

Wrong path or method: 404, 405
404 Not Found: nothing lives at that address. Note 99 doesn't exist. Check the path for a typo first.
curl -i http://notes.test/notes/99HTTP/1.1 404 NOT FOUND Server: nginx/1.24.0 (Ubuntu) Date: Fri, 04 Dec 2026 22:15:40 GMT Content-Type: application/json Content-Length: 23 Connection: keep-alive {"error":"no note 99"}
405 is the right address with the wrong method. PUT isn't allowed on /notes, and the Allow header lists what is. HEAD is just GET without the body. OPTIONS asks what's allowed.
curl -i -X PUT http://notes.test/notesHTTP/1.1 405 METHOD NOT ALLOWED Server: nginx/1.24.0 (Ubuntu) Date: Fri, 04 Dec 2026 22:15:41 GMT Content-Type: text/html; charset=utf-8 Content-Length: 153 Connection: keep-alive Allow: GET, POST, OPTIONS, HEAD <!doctype html> <html lang=en> <title>405 Method Not Allowed</title> <h1>Method Not Allowed</h1> <p>The method is not allowed for the requested URL.</p>
A conflict: 409
409 Conflict: your request clashes with what's already there. Sign up as dev, and the app says that user already exists. Pick another name.
curl -i --json '{"user":"dev"}' http://notes.test/signupHTTP/1.1 409 CONFLICT Server: nginx/1.24.0 (Ubuntu) Date: Fri, 04 Dec 2026 22:15:42 GMT Content-Type: application/json Content-Length: 36 Connection: keep-alive {"error":"user dev already exists"}
Too large: 413, and a 100
Now upload a backup of your notes, a 2.2 megabyte file. curl's -F sends it like a web form. 413 Request Entity Too Large: its newer name is Content Too Large. So who said no, Nginx or your app? journalctl shows your app's own log, and the last thing it saw was the signup from earlier. The upload never reached it: Nginx turned it away first.
ls -lh notes-backup.csv-rw-r--r-- 1 dev dev 2.2M Dec 4 22:12 notes-backup.csv
curl -i -F file=@notes-backup.csv http://notes.test/importHTTP/1.1 413 Request Entity Too Large Server: nginx/1.24.0 (Ubuntu) Date: Fri, 04 Dec 2026 22:15:45 GMT Content-Type: text/html Content-Length: 192 Connection: close <html> <head><title>413 Request Entity Too Large</title></head> <body> <center><h1>413 Request Entity Too Large</h1></center> <hr><center>nginx/1.24.0 (Ubuntu)</center> </body> </html>
sudo journalctl -u notes -o cat -n 2PUT /notes 405 POST /signup 409
Nginx allows one megabyte by default. The setting is called client_max_body_size.
So add one line to the config, in any editor, that sets it to ten megabytes: grep shows it's there. nginx -t checks the config for typos, and reload applies it. Upload again. First comes 100 Continue, a rare 100s code: Nginx saying keep sending. Then 201 Created: a hundred thousand notes imported.
grep -n client_max_body_size /etc/nginx/sites-available/notes6: client_max_body_size 10m;
sudo nginx -t && sudo systemctl reload nginxnginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful
curl -i -F file=@notes-backup.csv http://notes.test/importHTTP/1.1 100 Continue HTTP/1.1 201 CREATED Server: nginx/1.24.0 (Ubuntu) Date: Fri, 04 Dec 2026 22:15:51 GMT Content-Type: application/json Content-Length: 20 Connection: keep-alive {"imported":100000}
Can't use it: 422
422 is 400's careful cousin. This JSON is fine, but the title is empty, so the app can't use it. 422 means: I could read it, but it doesn't make sense. Some apps send 400 for both.
curl -i --json '{"title":""}' http://notes.test/notesHTTP/1.1 422 UNPROCESSABLE ENTITY Server: nginx/1.24.0 (Ubuntu) Date: Fri, 04 Dec 2026 22:15:52 GMT Content-Type: application/json Content-Length: 36 Connection: keep-alive {"error":"title must not be empty"}
Too many requests: 429
Your server also has a rate limit: one request a second from each computer, plus room for a quick burst of five extra. Now a loop sends ten requests as fast as it can, and prints only each status code. Guess first: when the limit kicks in, what does Nginx send by default? 503, Service Unavailable. The first six got 200: one, plus the burst of five. The last four got 503, Nginx's documented default: a server error, for something that's really on your side.
grep -n limit_req /etc/nginx/sites-available/notes1:limit_req_zone $binary_remote_addr zone=api:10m rate=1r/s; 18: limit_req zone=api burst=5 nodelay;
for i in $(seq 10); do curl -s -o /dev/null -w '%{http_code} ' http://notes.test/notes; done; echo200 200 200 200 200 200 503 503 503 503
So add one line that tells Nginx to send 429 instead: grep shows it. Reload, and send ten more. The first six still pass: one, plus the burst of five. Now the last four say 429 Too Many Requests: slow down. A well-behaved client waits, then tries again.
grep -n limit_req /etc/nginx/sites-available/notes1:limit_req_zone $binary_remote_addr zone=api:10m rate=1r/s; 18: limit_req zone=api burst=5 nodelay; 19: limit_req_status 429;
sudo nginx -t && sudo systemctl reload nginxnginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful
for i in $(seq 10); do curl -s -o /dev/null -w '%{http_code} ' http://notes.test/notes; done; echo200 200 200 200 200 200 429 429 429 429
curl -i http://notes.test/notesHTTP/1.1 429 Too Many Requests Server: nginx/1.24.0 (Ubuntu) Date: Fri, 04 Dec 2026 22:16:11 GMT Content-Type: text/html Content-Length: 178 Connection: keep-alive <html> <head><title>429 Too Many Requests</title></head> <body> <center><h1>429 Too Many Requests</h1></center> <hr><center>nginx/1.24.0 (Ubuntu)</center> </body> </html>
The 400s at a glance
The 400s come down to four checks. Fix what you sent: 400, 409, 422 and 413. Prove who you are, or get permission: 401 and 403. Check the path and the method: 404 and 405. And for 429, slow down.

The app crashed: 500
Back to the log from the start: 500, 502, 504, 503. Now let's make each one happen. The 500s mean the server failed, so the fix is on the server. 500 Internal Server Error: your app crashed on this request. The page won't say why. The app's log will: a KeyError, which means the code asked for a field called tags that isn't there.
curl -i http://notes.test/notes/exportHTTP/1.1 500 INTERNAL SERVER ERROR Server: nginx/1.24.0 (Ubuntu) Date: Fri, 04 Dec 2026 22:16:18 GMT Content-Type: text/html; charset=utf-8 Content-Length: 265 Connection: keep-alive <!doctype html> <html lang=en> <title>500 Internal Server Error</title> <h1>Internal Server Error</h1> <p>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.</p>
sudo journalctl -u notes -o cat -n 2KeyError: 'tags' GET /notes/export 500
No answer: 502 and 504
Now stop your app, the way a crash or a failed update would. Nginx is still running. Guess first: what do you get? 502 Bad Gateway. Nginx is the gateway, and it got no answer from the app behind it. See Nginx's name at the bottom of the page? That's how you know Nginx answered, not your app.
sudo systemctl stop notes
curl -i http://notes.test/notesHTTP/1.1 502 Bad Gateway Server: nginx/1.24.0 (Ubuntu) Date: Fri, 04 Dec 2026 22:16:22 GMT Content-Type: text/html Content-Length: 166 Connection: keep-alive <html> <head><title>502 Bad Gateway</title></head> <body> <center><h1>502 Bad Gateway</h1></center> <hr><center>nginx/1.24.0 (Ubuntu)</center> </body> </html>
Nginx's error log says exactly why: connection refused. Nothing is listening where the app should be. Start the app, and you're back to 200.
sudo tail -n 1 /var/log/nginx/error.log2026/12/04 22:16:22 [error] 182#182: *67 connect() failed (111: Connection refused) while connecting to upstream, client: 172.18.0.3, server: notes.test, request: "GET /notes HTTP/1.1", upstream: "http://127.0.0.1:8000/notes", host: "notes.test"
sudo systemctl start notes
curl -i http://notes.test/notesHTTP/1.1 200 OK Server: nginx/1.24.0 (Ubuntu) Date: Fri, 04 Dec 2026 22:16:27 GMT Content-Type: application/json Content-Length: 64 Connection: keep-alive [{"id":1,"title":"buy milk"},{"id":2,"title":"renew passport"}]
504 Gateway Timeout is 502's slow cousin: the app is running, just too slow. The report takes ten seconds, and this Nginx waits five. So after five seconds it gives up: 504. Nginx calls your app its upstream, and the error log says the upstream timed out.
grep -n proxy_read_timeout /etc/nginx/sites-available/notes22: proxy_read_timeout 5s;
time curl -i http://notes.test/notes/reportHTTP/1.1 504 Gateway Time-out Server: nginx/1.24.0 (Ubuntu) Date: Fri, 04 Dec 2026 22:16:35 GMT Content-Type: text/html Content-Length: 176 Connection: keep-alive <html> <head><title>504 Gateway Time-out</title></head> <body> <center><h1>504 Gateway Time-out</h1></center> <hr><center>nginx/1.24.0 (Ubuntu)</center> </body> </html> real 0m5.015s user 0m0.003s sys 0m0.004s
sudo tail -n 1 /var/log/nginx/error.log2026/12/04 22:16:35 [error] 182#182: *71 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 172.18.0.3, server: notes.test, request: "GET /notes/report HTTP/1.1", upstream: "http://127.0.0.1:8000/notes/report", host: "notes.test"
Speed up the app, or raise proxy_read_timeout. Its default is sixty seconds.
Not right now: 503
Last, 503 Service Unavailable: not right now, try later. You saw Nginx use it for the rate limit. Its classic use is maintenance. This config tells Nginx: while a file called maintenance.on exists, answer 503. Create the file, and every request gets 503: maintenance mode. Remove it, and you're back.
grep -n -A2 maintenance /etc/nginx/sites-available/notes9: if (-f /var/www/notes/maintenance.on) { 10- return 503; 11- }
sudo touch /var/www/notes/maintenance.on
curl -i http://notes.test/notesHTTP/1.1 503 Service Temporarily Unavailable Server: nginx/1.24.0 (Ubuntu) Date: Fri, 04 Dec 2026 22:16:40 GMT Content-Type: text/html Content-Length: 206 Connection: keep-alive <html> <head><title>503 Service Temporarily Unavailable</title></head> <body> <center><h1>503 Service Temporarily Unavailable</h1></center> <hr><center>nginx/1.24.0 (Ubuntu)</center> </body> </html>
sudo rm /var/www/notes/maintenance.on
curl -i http://notes.test/notesHTTP/1.1 200 OK Server: nginx/1.24.0 (Ubuntu) Date: Fri, 04 Dec 2026 22:16:43 GMT Content-Type: application/json Content-Length: 64 Connection: keep-alive [{"id":1,"title":"buy milk"},{"id":2,"title":"renew passport"}]
The 500s at a glance
The 500s at a glance: 500, your app crashed: read its log. 502, no answer at all: is the app running? 504, too slow: check the app and the timeout. 503, not now: wait, then retry.

Recap
So start with the first digit, like the parcel. 200s: delivered. 300s: look where Location points. 400s: returned, fix your request. 500s: the server failed, read its logs. And if Nginx's name is on the page, Nginx answered.
If your server's log makes sense now, subscribe for more on how the web really works.
The lab, the config and every command are in the description, so you can make each of these codes yourself. Thanks for watching Cloud Explainers.
Sources
Demos: two containers on our own Mac standing in for your server and your laptop. The notes app and its tokens are made up; every request, status line, header and log line was real. Watch the full video on YouTube.