Back to practice tasks

practice task

Check Whether Nginx Config Is Valid

A teammate changed a server block and wants to reload nginx. You need to prove the configuration parses before touching the running service.

Independent study support only. No affiliation, endorsement, exam dumps, or guaranteed exam results.

Try first

sudo nginx -t

Goal

Run the nginx configuration test and identify the file and line number if it fails.

Expected output

A success message such as syntax is ok and test is successful, or an error that names the failing file and line.

Teaches

Validate before reload. A config test is a low-risk checkpoint between editing and changing live traffic.

Common mistake

Reloading immediately after editing and turning a syntax typo into an outage.

command set

Commands to know

  1. nginx -t
  2. sudo nginx -t
  3. systemctl reload nginx

Watch this command run

Example output from a temporary Linux lab

next practice

Find Which Process Owns a Port

Port 8080 is already in use and a new service will not start. You need to identify the listener before killing or reconfiguring anything.