nginx

If there is an error when reloading nginx, how does nginx maintain the existing version?


I'm curious as I'm doing an uninterrupted deployment with nginx and I'm asking.

I reloaded to update the loadbalancer made with nginx.

But if there is a syntax error in the nginx code, there is no existing code, but how can it continue to work?

I am curious about the nginx reload process.


Solution

  • If you have a syntax error and try to reload

    sudo Nginx -s reload
    

    Nginx will detect the error and will not change the current configuration.

    If you restart the process

    sudo systemctl restart nginx.service
    

    Then your Nginx process will fail and not start until you solve the error.

    The points are when the Nginx going to start the process it loads the configuration from the file to the process memory if you try to reload and the config is broken is not a problem because it has the config on memory but if you restart you'll destroy the memory information an then you'll need to read from file again because the file is broken fails.