2 Replies - 759 Views - Last Post: 18 June 2019 - 10:32 AM

#1 Petro Gromovo   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 21
  • Joined: 14-February 19

About nginx reload commands

Posted 17 June 2019 - 06:01 AM

Hello,
reading some nginx manuals I see 2 commands :
sudo service nginx restart
sudo systemctl reload nginx

Is it the same command with different syntax?

Thanks!
Is This A Good Question/Topic? 0
  • +

Replies To: About nginx reload commands

#2 no2pencil   User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6816
  • View blog
  • Posts: 31,414
  • Joined: 10-May 07

Re: About nginx reload commands

Posted 17 June 2019 - 06:17 AM

** Moved to Web Servers & Hosting, question not related to PHP **

systemctl is a wrapper, calling service uses the OS init script for the service.

Also note that reload & restart are different for the service, not the calling command. Restart kills any current connections, reload just loads the new configs. Issuing by restart will stop the service, & then start it. So if there are any syntax errors in your config, the service does not restart & is not running. Issuing by reload leaves the previous services running & is safer.
Was This Post Helpful? 1
  • +
  • -

#3 Radius Nightly   User is offline

  • D.I.C Regular

Reputation: 39
  • View blog
  • Posts: 318
  • Joined: 07-May 15

Re: About nginx reload commands

Posted 18 June 2019 - 10:32 AM

As he said, reload just reload configurations and settings of Nginx, its usefull if you are adding another host, doing some changes to the existing one, deleting hosts, adding another server machine, dividing server regions or so, and you dont wanna interrupt current users on the server, because its not needed.
https://docs.nginx.c...untime-control/

Restarting services means Nginx will be shutdown, all connections will be cut off imediatelly, server goes offline, and Nginx will start as a new, load everything from the beggining, like when you restart a PC. How long this took safetly depends on the settings of the operating system, its usually up to 5min without cutting any current workload, or less then 5sec by force. Its wise to configure Nginx service to automaticaly do reload or restart in chase of failure or so. Eventually everything can be automatized.
But, the best way are to announce maintenance, so users will know when it will go offline, before maintenance, block new users, redirect them to maintenance page/server/host/PC/backup/DNS message, and let current users finish their things (such as uploads or IDK what they are doing), as well as server its things. Stop all services, do maintenance, make backup, reset PC, etc., whatever you need to do, and start up all services (Nginx, PHP, FTP, SQL, etc.) so it continue to work.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1