Hosting Operations
Read-only, can be slowMap Nginx Proxy Targets
Nginx returns 502, serves a stale app, or reaches the wrong backend, and you need to see exactly where proxied requests are sent.
Command
grep -RInE '^[[:space:]]*proxy_pass[[:space:]]' fixtures/nginx/conf.d fixtures/nginx/sites-enabled
Before you run this
System impact: Read-only. Can create load on large logs, directories, filesystems, or process tables.
When not to use it: Do not assume the upstream process is running just because the config points to it. Check the backend listener and app logs next.
Expected output
Config paths and `proxy_pass` target URLs, usually hostnames, sockets, local ports, or upstream names.
System impact
Read-only, can be slow. Nothing changes. The command lists `proxy_pass` targets from config text.
Scope this to the smallest useful path or service on busy systems.
Recovery / rollback: no state is changed.
When to use it
Use when 502s, stale apps, wrong containers, or unexpected backends suggest a proxy target problem.
When not to use it
Do not assume the upstream process is running just because the config points to it. Check the backend listener and app logs next.
Watch this command run
Command transcript
This sanitized transcript shows the commands and output shape without exposing host details.
$ grep -RInE '^[[:space:]]*proxy_pass[[:space:]]' sample-files/nginx/conf.d sample-files/nginx/sites-enabled
sample-files/nginx/conf.d/admin.conf:6: proxy_pass http://localhost:9100;
sample-files/nginx/sites-enabled/example.conf:16: proxy_pass http://localhost:9000/;
$ grep -RInE 'proxy_set_header[[:space:]]+Host' sample-files/nginx/conf.d sample-files/nginx/sites-enabled
sample-files/nginx/sites-enabled/example.conf:15: proxy_set_header Host $host;
View commands shown
These are the commands shown in the sanitized transcript.
Commands shown
grep -RInE '^[[:space:]]*proxy_pass[[:space:]]' fixtures/nginx/conf.d fixtures/nginx/sites-enabledgrep -RInE 'proxy_set_header[[:space:]]+Host' fixtures/nginx/conf.d fixtures/nginx/sites-enabled
next steps
Related commands
List Nginx Listen Directives
The site was configured, but the port was not.
grep -RInE '^[[:space:]]*listen[[:space:]]' fixtures/nginx/conf.d fixtures/nginx/sites-enabled
Map Nginx Roots and Aliases
The URL was right. The filesystem path was not.
grep -RInE '^[[:space:]]*(root|alias)[[:space:]]' fixtures/nginx/conf.d fixtures/nginx/sites-enabled
Show Nginx Include Lines
The config was valid; it just was not included.
grep -RInE '^[[:space:]]*include[[:space:]]' fixtures/nginx/nginx.conf fixtures/nginx/conf.d fixtures/nginx/sites-enabled
Map Apache Proxy Rules
Apache was up. The reverse proxy target was wrong.
grep -RInE '^[[:space:]]*(ProxyPass|ProxyPassReverse)[[:space:]]' fixtures/apache/sites-enabled
Find the Nginx Default Server
The wrong site answered because it was the fallback.
grep -RIn 'default_server' fixtures/nginx/conf.d fixtures/nginx/sites-enabled
Study mapping
Use this as independent command practice: read the notes, predict the output, then compare it with the example before using a real shell.
Useful for
- LPIC-1 style command-line practice
- LFCS style performance tasks
- Linux+ style troubleshooting review
Independent study support only. No affiliation, endorsement, exam dumps, or real exam questions.