Hosting Operations
Read-onlyShow Enabled Nginx Sites
You need to see which Nginx site configs are actually enabled.
Command
ls -l /etc/nginx/sites-enabled/
Before you run this
System impact: Read-only. Low when scoped to the shown target.
When not to use it: Do not delete symlinks from this list unless you know the site should be disabled.
Expected output
Enabled site config filenames or symlink targets.
System impact
Read-only. Nothing changes. The command lists enabled config symlinks.
May require elevated permissions on protected paths or service-owned files.
Recovery / rollback: no state is changed.
When to use it
Use this when a server block edit seems ignored.
When not to use it
Do not delete symlinks from this list unless you know the site should be disabled.
Watch this command run
Command transcript
This sanitized transcript shows the commands and output shape without exposing host details.
$ ls -l /etc/nginx/sites-enabled/
total 0
lrwxrwxrwx 1 root root 38 Jun 26 00:27 example.com -> /etc/nginx/sites-available/example.com
$ readlink -f /etc/nginx/sites-enabled/example.com
/etc/nginx/sites-available/example.com
$ nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
View commands shown
These are the commands shown in the sanitized transcript.
Commands shown
ls -l /etc/nginx/sites-enabled/readlink -f /etc/nginx/sites-enabled/example.comnginx -t
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
Show Enabled Apache Sites
The Apache config existed. The enabled symlink did not.
find fixtures/apache/sites-enabled -maxdepth 1 -type l -printf '%f -> %l\n' | sort
Find Which Nginx Config Owns a Domain
The wrong server block was answering the domain.
grep -R "server_name" /etc/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
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.