How to check the status of Nginx startup in Linux?
To check the startup status of nginx, you can use the following command: 1. Use the `systemctl` command (for systems managed by systemd).
systemctl status nginx
This will display the current status of nginx, including whether it is running and for how long it has been running. Alternatively, use the `service` command (for systems managed by init).
service nginx status
This will display the current status of nginx, including whether it is running and the time it has been running. 3. Use the ‘ps’ command to find the nginx process.
ps aux | grep nginx
This will display detailed information about the running nginx process, including the Process ID (PID) and startup command. Regardless of the method used, if nginx is running, you will see output similar to the following:
nginx.service - The nginx HTTP and reverse proxy serverLoaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2022-02-09 09:35:57 UTC; 3s ago
Docs: http://nginx.org/en/docs/
Main PID: 12345 (nginx)
Tasks: 2 (limit: 2361)
Memory: 3.2M
CGroup: /system.slice/nginx.service
├─12345 nginx: master process /usr/sbin/nginx -g daemon on; master_process on
└─12346 nginx: worker process
If nginx is not running, you will see an output similar to the following:
nginx.service - The nginx HTTP and reverse proxy serverLoaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: inactive (dead)
Docs: http://nginx.org/en/docs/