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
nginx -tsudo nginx -tsystemctl reload nginx
Related lessons
Watch this command run
Example output from a temporary Linux lab
Test Nginx Config Before Reload
Review the related command card and compare your expected output with the command replay.
Watch command runCheck Nginx Symlink Target
Review the related command card and compare your expected output with the command replay.
Watch command runnext 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.