Hosting Operations
Map Nginx Roots and Aliases
You need to find which document roots and aliases Nginx config points at.
Command
grep -RInE '^[[:space:]]*(root|alias)[[:space:]]' fixtures/nginx/conf.d fixtures/nginx/sites-enabled
What changed
Nothing changes. The command lists filesystem path directives from config.
Danger
safe
When to use it
Use when static assets, uploads, or index files return 404 unexpectedly.
When not to use it
Do not assume root and alias behave the same inside location blocks.
Undo or recovery
No undo needed because this command is read-only.
Expected output
Config paths and lines containing root or alias directives.
demo script
Disposable terminal steps
grep -RInE '^[[:space:]]*(root|alias)[[:space:]]' fixtures/nginx/conf.d fixtures/nginx/sites-enabledgrep -RInE '^[[:space:]]*location[[:space:]]' fixtures/nginx/conf.d fixtures/nginx/sites-enabled
simulated output
What it looks like
::fixture-ready::
$ grep -RInE '^[[:space:]]*(root|alias)[[:space:]]' fixtures/nginx/conf.d fixtures/nginx/sites-enabled
fixtures/nginx/conf.d/admin.conf:4: root /srv/www/admin;
fixtures/nginx/sites-enabled/example.conf:9: root /srv/www/example/current/public;
fixtures/nginx/sites-enabled/example.conf:12: alias /srv/www/example/current/assets/;
::exit-code::0
$ grep -RInE '^[[:space:]]*location[[:space:]]' fixtures/nginx/conf.d fixtures/nginx/sites-enabled
fixtures/nginx/conf.d/admin.conf:5: location / {
fixtures/nginx/sites-enabled/example.conf:11: location /assets/ {
fixtures/nginx/sites-enabled/example.conf:14: location /api/ {
::exit-code::0
YouTube Short
Find where Nginx serves files.
A 404 can be a path problem, not an app problem. List root and alias directives before moving files.
LinkedIn hook
The URL was right. The filesystem path was not.
Question: Do you check root and alias before debugging static-file 404s?
experiments
A/B tests to run
Metric: save_rate
A: The path was wrong.
B: Map root and alias lines.