NGINX Cheat Sheet

 



To manage the Nginx web server on a Linux system using systemd (which is used by most modern Linux distributions including Ubuntu), you can use the `systemctl` command. Here are the common commands for starting, stopping, checking the status, and restarting Nginx:


1. **Check the status of the Nginx server**:

   ```bash

   sudo systemctl status nginx

   ```

   This command displays the current status of the Nginx server, including whether it is running or not, and recent log entries.


2. **Start the Nginx server**:

   ```bash

   sudo systemctl start nginx

   ```

   Use this command to start the Nginx service if it's not already running.


3. **Stop the Nginx server**:

   ```bash

   sudo systemctl stop nginx

   ```

   This command stops the Nginx server. It's useful if you need to halt the server for maintenance or any other purpose.


4. **Restart the Nginx server**:

   ```bash

   sudo systemctl restart nginx

   ```

   Restarting is typically needed when you have made configuration changes. This command stops the server and starts it again.


5. **Reload the Nginx configuration without dropping connections**:

   ```bash

   sudo systemctl reload nginx

   ```

   If you've made changes to the Nginx configuration files, you can use this command to apply the changes without interrupting ongoing connections. This is less disruptive than a full restart and is generally recommended for applying changes in a production environment.


These commands should cover most scenarios for managing the Nginx service on your server.

Comments

Popular posts from this blog

Obtaining Google Application Credentials for Python Development: A Comprehensive Guide

Flask 101

HOWTO - SSH via Mac Terminal