Back to lessons

Hosting Operations

Show Enabled Nginx Sites

You need to see which Nginx site configs are actually enabled.

Command

ls -l /etc/nginx/sites-enabled/

What changed

Nothing changes. The command lists enabled config symlinks.

Danger

safe

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.

Undo or recovery

No state is changed.

Expected output

Enabled site config filenames or symlink targets.

demo script

Disposable terminal steps

  1. ls -l /etc/nginx/sites-enabled/
  2. readlink -f /etc/nginx/sites-enabled/example.com
  3. nginx -t

simulated output

What it looks like

disposable vessel
::fixture-ready::
$ ls -l /etc/nginx/sites-enabled/
total 0
lrwxrwxrwx 1 root root 38 Jun 25 13:19 example.com -> /etc/nginx/sites-available/example.com
::exit-code::0
$ readlink -f /etc/nginx/sites-enabled/example.com
/etc/nginx/sites-available/example.com
::exit-code::0
$ nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
::exit-code::0

YouTube Short

Is the Nginx site enabled?

Editing a config is not enough. Check whether Nginx actually has that site enabled.

LinkedIn hook

The config existed, but it was not enabled.

Question: Have you ever edited the available site instead of the enabled one?

experiments

A/B tests to run

Metric: search_click_rate

A: Show enabled Nginx sites.

B: The config existed, but it was not enabled.