Hosting Operations
Find Apache Document Roots
You need to list DocumentRoot values from enabled Apache configs.
Command
grep -RInE '^[[:space:]]*DocumentRoot[[:space:]]' fixtures/apache/sites-enabled
What changed
Nothing changes. The command prints DocumentRoot config lines.
Danger
safe
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.
Undo or recovery
No undo needed because this command is read-only.
Expected output
Enabled Apache config files and DocumentRoot paths.
demo script
Disposable terminal steps
grep -RInE '^[[:space:]]*DocumentRoot[[:space:]]' fixtures/apache/sites-enabledgrep -RInE '
simulated output
What it looks like
::fixture-ready::
$ grep -RInE '^[[:space:]]*DocumentRoot[[:space:]]' fixtures/apache/sites-enabled
fixtures/apache/sites-enabled/app.conf:3: DocumentRoot /srv/www/app/public
fixtures/apache/sites-enabled/example.conf:4: DocumentRoot /srv/www/legacy/public
::exit-code::0
$ grep -RInE '
fixtures/apache/sites-enabled/app.conf:2: ServerName app.example.com
fixtures/apache/sites-enabled/example.conf:1:
fixtures/apache/sites-enabled/example.conf:2: ServerName legacy.example.com
::exit-code::0
YouTube Short
Where is Apache serving from?
Before moving files or changing permissions, list Apache DocumentRoot lines. The web server may be looking elsewhere.
LinkedIn hook
Apache was serving files from a different directory than expected.
Question: Do you verify DocumentRoot before fixing web file permissions?
experiments
A/B tests to run
Metric: completion_rate
A: Wrong directory.
B: Find DocumentRoot before chmod.