{"id":3178,"date":"2025-02-19T14:59:36","date_gmt":"2025-02-19T14:59:36","guid":{"rendered":"https:\/\/foghosting.com\/how-to-start-stop-and-restart-nginx-in-linux-2-methods\/"},"modified":"2025-02-19T14:59:36","modified_gmt":"2025-02-19T14:59:36","slug":"how-to-start-stop-and-restart-nginx-in-linux-2-methods","status":"publish","type":"post","link":"https:\/\/foghosting.com\/blog\/how-to-start-stop-and-restart-nginx-in-linux-2-methods\/","title":{"rendered":"How to Start, Stop, and Restart Nginx in Linux? (2 Methods)"},"content":{"rendered":"<div>\n<h2><span id=\"Introduction\"><strong>Introduction<\/strong><\/span><\/h2>\n<p>Nginx, which sounds like \u201cengine x,\u201d is an outstanding performance HTTP primarily reverse proxy server that is free, open-source, and currently in charge of managing the load on most of the busiest websites on the Internet. This can be utilized as an independent web server or it can serve as a reverse proxy for Apache along with other web servers.<\/p>\n<p>Most likely, whether you work as a programmer or system administrator, you deal with Nginx routinely. The most frequently performed tasks while working with an Nginx web server are starting, halting, and then restarting\/reloading.<\/p>\n<p>The process to <strong>Start, Stop, and Restart Nginx in Linux<\/strong> servers is covered in this tutorial.<\/p>\n<h2><span id=\"System_Requirements\"><strong>System Requirements<\/strong><\/span><\/h2>\n<figure><\/figure>\n<p>You\u2019ll require<\/p>\n<ul>\n<li>a machine with Nginx configure and set up<\/li>\n<li>the ability to use a terminal window and command line<\/li>\n<li>an individual account with root or sudo rights<\/li>\n<li>If the scenario that you\u2019re working remotely, an active SSH connection to a distant system<\/li>\n<\/ul>\n<h2><span id=\"Start_Stop_and_Restart_Nginx_in_Linux_using_systemctl\"><strong>Start Stop and Restart Nginx in Linux using systemctl<\/strong><\/span><\/h2>\n<figure><\/figure>\n<figure><\/figure>\n<p>The most recent versions of Ubuntu 18.04\/16.04, CentOS 7\/8, &#038; Debian 10\/9 use SystemD as their system and service manager.<\/p>\n<p>Restarting or reloading the web server processes is necessary each time you make adjustments to the <strong>start Nginx configuration<\/strong>. The Nginx service has to get restarted. Run the following command:<\/p>\n<pre><code>sudo systemctl restart nginx<strong>\n<\/strong><\/code><\/pre>\n<p>If possible, reload rather than restart when modifying or adding server blocks. Whenever you make significant changes, such as switching ports or interfaces, you should <strong>restart the nginx<\/strong> service. When a page gets reloaded, Nginx loads the updated configuration, launches fresh worker processes using the updated configuration, and gently terminates older worker processes.<\/p>\n<p>To relaunch your Nginx service, execute the command below:<\/p>\n<pre><code>sudo systemctl restart nginx<strong>\n<\/strong><\/code><\/pre>\n<figure><\/figure>\n<p>Additionally, signals may get utilized to directly regulate Nginx. For instance, you might execute the following command for reloading the service:<\/p>\n<pre><code>sudo \/usr\/sbin\/nginx -s reload<\/code><\/pre>\n<figure><\/figure>\n<p>Execute the following command to launch the <strong>start Nginx <\/strong>service.<\/p>\n<pre><code>sudo systemctl start nginx<\/code><\/pre>\n<p><strong><\/strong><\/p>\n<p>To terminate the Nginx service, enter the following command:<\/p>\n<pre><code>sudo systemctl stop nginx<\/code><\/pre>\n<p><strong><\/strong><\/p>\n<h2><span id=\"Start_Stop_and_Restart_Nginx_using_Command_Line\"><strong>Start Stop and Restart Nginx using Command Line<\/strong><\/span><\/h2>\n<figure><\/figure>\n<p>Your Nginx command provides the ability to use the set of integrated management tools that Nginx provides for the service.<\/p>\n<h3><span id=\"Start_with_Nginx\"><strong>Start with Nginx<\/strong><\/span><\/h3>\n<p>Type the following to launch Nginx and its associated processes:<\/p>\n<pre><code>sudo \/etc\/init.d\/nginx start<\/code><\/pre>\n<p>The terminal window display is going to display the following when the operation was successful:<\/p>\n<p>The output<\/p>\n<ul>\n<li>[ ok ] Starting nginx (via systemctl): nginx.service.<\/li>\n<\/ul>\n<h3><span id=\"Restarting_Nginx\"><strong>Restarting Nginx<\/strong><\/span><\/h3>\n<p>To forcefully stop and <strong>resume Nginx<\/strong> and associated processes:<\/p>\n<pre><code>sudo \/etc\/init.d\/nginx restart<\/code><\/pre>\n<p>On the other hand, employ this nginx -s command:<\/p>\n<pre><code>sudo nginx -s restart nginx\u00a0<\/code><\/pre>\n<h3><span id=\"Stop_NGINX\"><strong>Stop NGINX<\/strong><\/span><\/h3>\n<p>Use the following commands to halt or deactivate the Nginx service:<\/p>\n<pre><code>sudo \/etc\/init.d\/nginx stop<\/code><\/pre>\n<p>You may also use:<\/p>\n<pre><code>sudo nginx -s stop<\/code><\/pre>\n<h3><span id=\"Reloading_Nginx\"><strong>Reloading Nginx<\/strong><\/span><\/h3>\n<p>Nginx and its associated processes can be properly <strong>stopped and restarted by using nginx<\/strong> the following command:<\/p>\n<pre><code>sudo \/etc\/init.d\/nginx reload<\/code><\/pre>\n<p>If you\u2019d rather give Nginx commands right away, you can do so by using the nginx -s command:<\/p>\n<pre><code>sudo nginx -s reload<\/code><\/pre>\n<figure><\/figure>\n<h3><span id=\"Nginx_Quit\"><strong>Nginx Quit\u00a0<\/strong><\/span><\/h3>\n<p>Force Utilise the quit command along with the nginx -s command to <strong>stop the Nginx<\/strong> service:<\/p>\n<pre><code>sudo nginx -s quit<\/code><\/pre>\n<figure><\/figure>\n<h2><span id=\"Start_Stop_and_Reload_Nginx_using_SysVinit\"><strong>Start, Stop and Reload Nginx using SysVinit<\/strong><\/span><\/h2>\n<figure><\/figure>\n<p>An Nginx service gets started, stopped, and restarted utilizing init.d scripts in previous (EOLed) editions of Ubuntu, and CentOS, including Debian.<\/p>\n<p>Restarting Nginx is necessary:<\/p>\n<pre><code>sudo service nginx restart<strong>\n<\/strong><\/code><\/pre>\n<p>Activate the Nginx services:<\/p>\n<pre><code>sudo service nginx start<strong>\n<\/strong><\/code><\/pre>\n<p>Suspend the Nginx services:<\/p>\n<pre><code>sudo service nginx stop\n<\/code><\/pre>\n<h2><span id=\"Summing_Up\"><strong>Summing Up<\/strong><\/span><\/h2>\n<p>In this article, I have explained <strong>how starting, stopping, and restarting Nginx in Linux <\/strong>on the server got covered in this post. If you\u2019re administering an Nginx web server, you can use the aforementioned commands for the tasks that come up most often.<\/p>\n<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Nginx, which sounds like \u201cengine x,\u201d is an outstanding performance HTTP primarily reverse proxy server that is free, open-source, and currently in charge of managing the load on most of the busiest websites on the Internet. This can be utilized as an independent web server or it can serve as a reverse proxy for<\/p>\n","protected":false},"author":3,"featured_media":3076,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[17],"tags":[],"class_list":["post-3178","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dedicated-servers"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/foghosting.com\/blog\/wp-json\/wp\/v2\/posts\/3178","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/foghosting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/foghosting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/foghosting.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/foghosting.com\/blog\/wp-json\/wp\/v2\/comments?post=3178"}],"version-history":[{"count":0,"href":"https:\/\/foghosting.com\/blog\/wp-json\/wp\/v2\/posts\/3178\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/foghosting.com\/blog\/wp-json\/wp\/v2\/media\/3076"}],"wp:attachment":[{"href":"https:\/\/foghosting.com\/blog\/wp-json\/wp\/v2\/media?parent=3178"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/foghosting.com\/blog\/wp-json\/wp\/v2\/categories?post=3178"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/foghosting.com\/blog\/wp-json\/wp\/v2\/tags?post=3178"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}