I'm writing a GUI where users can edit their NGINX vhost information. Before updating their vhost I would like to perform a syntax check. That's why my idea was to copy the new contents to tmp
first and then run a NGINX syntax check only on that certain file (instead of nginx -t
which will check all vhosts and only in the appropriate nginx-directories).
Is is somehow possible to syntax-check one certain file only before pasting it from /tmp/new_vhost_content
to /etc/nginx/sites-enables/vhost
?
To check a single config use the parameter -c ex.
nginx -t -c /path/to/conf