Back to commands

Hosting Operations

Read-only

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

next steps

Related commands

Hosting Operations Can be slow

List Nginx Listen Directives

The site was configured, but the port was not.

grep -RInE '^[[:space:]]*listen[[:space:]]' /etc/nginx/conf.d /etc/nginx/sites-enabled 2>/dev/null
Hosting Operations Can be slow

Show Enabled Apache Sites

The Apache config existed. The enabled symlink did not.

find /etc/apache2/sites-enabled -maxdepth 1 -type l -printf '%f -> %l\n' 2>/dev/null | sort
Hosting Operations Can be slow

Show Nginx Include Lines

The config was valid; it just was not included.

grep -RInE '^[[:space:]]*include[[:space:]]' /etc/nginx/nginx.conf /etc/nginx/conf.d /etc/nginx/sites-enabled 2>/dev/null
Hosting Operations Can be slow

Find the Nginx Default Server

The wrong site answered because it was the fallback.

grep -RIn 'default_server' /etc/nginx/conf.d /etc/nginx/sites-enabled 2>/dev/null
Hosting Operations Can be slow

Map Nginx Proxy Targets

Nginx was healthy. It was proxying to the wrong place.

grep -RInE '^[[:space:]]*proxy_pass[[:space:]]' /etc/nginx/conf.d /etc/nginx/sites-enabled 2>/dev/null
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.

  • LPIC-1 style command-line practice
  • LFCS style performance-task practice
  • Linux+ style troubleshooting review

Independent study support only. No affiliation, endorsement, exam dumps, or real exam questions.