Back to commands

Hosting Operations

Read-only, can be slow

Find Apache Document Roots

You need to list DocumentRoot values from enabled Apache configs.

Command

grep -RInE '^[[:space:]]*DocumentRoot[[:space:]]' fixtures/apache/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 change file permissions until you verify Apache is pointing at the expected directory.

Expected output

Enabled Apache config files and DocumentRoot paths.

System impact

Read-only, can be slow. Nothing changes. The command prints DocumentRoot config lines.

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 files, index pages, or deploy output appear missing.

When not to use it

Do not change file permissions until you verify Apache is pointing at the expected directory.

Watch this command run

Command transcript

This sanitized transcript shows the commands and output shape without exposing host details.

demo@lab:~$

$ grep -RInE '^[[:space:]]*DocumentRoot[[:space:]]' sample-files/apache/sites-enabled

sample-files/apache/sites-enabled/app.conf:3:    DocumentRoot /srv/www/app/public
sample-files/apache/sites-enabled/example.conf:4:    DocumentRoot /srv/www/legacy/public

$ grep -RInE '<VirtualHost|ServerName' sample-files/apache/sites-enabled

sample-files/apache/sites-enabled/app.conf:1:<VirtualHost *:443>
sample-files/apache/sites-enabled/app.conf:2:    ServerName example.com
sample-files/apache/sites-enabled/example.conf:1:<VirtualHost *:80>
sample-files/apache/sites-enabled/example.conf:2:    ServerName example.com
View commands shown

These are the commands shown in the sanitized transcript.

Commands shown

  1. grep -RInE '^[[:space:]]*DocumentRoot[[:space:]]' fixtures/apache/sites-enabled
  2. grep -RInE '<VirtualHost|ServerName' fixtures/apache/sites-enabled

next steps

Related commands

Hosting Operations Can be slow

Map Apache Proxy Rules

Apache was up. The reverse proxy target was wrong.

grep -RInE '^[[:space:]]*(ProxyPass|ProxyPassReverse)[[:space:]]' fixtures/apache/sites-enabled
Hosting Operations Can be slow

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
Hosting Operations Can be slow

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
Hosting Operations Can be slow

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
Hosting Operations Can be slow

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
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.

  • lpic1:103-gnu-unix-commands
  • lfcs:essential-commands
  • lfcs:operations-deployment
  • lfcs:services-logs
  • linuxplus:automation-scripting
  • linuxplus:provisional
  • risk:read-only

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.