Last night a colleague edited the lab-site site on the server and restarted nginx. In the morning the site does not answer: nginx is down. The nginx configuration is kept in git — the /etc/nginx directory keeps a history of edits. Check what nginx complains about and ask git what has changed.
See what nginx complains about
In /etc/nginx test the nginx configuration, then ask git which files have changed.
First, predict
nginx did not come up after the edit. What will the configuration test sudo nginx -t print?
Now start the exercise, run the command and compare your prediction with the output.
git status called conf.d/lab-site.conf modified. What did git compare the file with?
-
There is no
lab-site.confin the package — a colleague created it. git can compare only with its own snapshots in.git. -
git knows nothing about the running nginx — it looks only into the
.gitdirectory. Besides, nginx is down and has no loaded config. -
Modification time does not decide it: git compares content. A file saved with no changes is not reported as modified by
git status.
git status compares the working files with the last commit — a snapshot kept in .git.