Hosting Operations
Read-only, can be slowMap 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
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 root and alias behave the same inside location blocks.
Expected output
Config paths and lines containing root or alias directives.
System impact
Read-only, can be slow. Nothing changes. The command lists filesystem path directives from config.
Scope this to the smallest useful path or service on busy systems.
Recovery / rollback: no state is changed.
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.
Watch this command run
Command transcript
This sanitized transcript shows the commands and output shape without exposing host details.
$ grep -RInE '^[[:space:]]*(root|alias)[[:space:]]' sample-files/nginx/conf.d sample-files/nginx/sites-enabled
sample-files/nginx/conf.d/admin.conf:4: root /srv/www/admin;
sample-files/nginx/sites-enabled/example.conf:9: root /srv/www/example/current/public;
sample-files/nginx/sites-enabled/example.conf:12: alias /srv/www/example/current/assets/;
$ grep -RInE '^[[:space:]]*location[[:space:]]' sample-files/nginx/conf.d sample-files/nginx/sites-enabled
sample-files/nginx/conf.d/admin.conf:5: location / {
sample-files/nginx/sites-enabled/example.conf:11: location /assets/ {
sample-files/nginx/sites-enabled/example.conf:14: location /api/ {
View commands shown
These are the commands shown in the sanitized transcript.
Commands shown
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
next steps
Related commands
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
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 Proxy Targets
Nginx was healthy. It was proxying to the wrong place.
grep -RInE '^[[:space:]]*proxy_pass[[:space:]]' fixtures/nginx/conf.d fixtures/nginx/sites-enabled
Find Apache Document Roots
Apache was serving files from a different directory than expected.
grep -RInE '^[[:space:]]*DocumentRoot[[:space:]]' fixtures/apache/sites-enabled
Find Web Server Redirect Rules
The redirect loop was hiding in plain text.
grep -RInE 'return[[:space:]]+30[18]|rewrite[[:space:]]|Redirect[[:space:]]|RewriteRule|RewriteCond' fixtures/nginx fixtures/apache
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.