Nginx: Essential Commands

Frequently used commands

Install Nginx


sudo apt-get install nginx



Start And Stop Nginx server

Start


sudo systemctl start nginx


Stop


sudo systemctl stop nginx



Current Status


sudo systemctl status nginx



Restart And Reload

Restart


sudo systemctl restart nginx


Reload


sudo systemctl reload nginx



Enable Or Disable

Enable(Start Automatically)


sudo systemctl enable nginx


Disable( Stop automatic Start On booting)


sudo systemctl disable nginx



Completely remove nginx


sudo apt-get purge nginx nginx-common nginx-full



Test Configuration


sudo nginx -t



Related

Add symbolic link


sudo ln -s  /etc/nginx/sites-available/your-server etc /etc/nginx/sites-enabled


Clean cache


sudo apt-get autoclean
sudo apt-get autoremove


Related Posts

How to run python file in terminal
July 3, 2024

Open the terminal from you script directory ( Go to the folder where your python script is or the script you want to run. [ after going to the folder, click right mouse button … you find open in terminal option]) and run python3 python_file_name.py Copy If you know your python file location you can […]

Add, Delete, and Update Accounts in Ubuntu from Terminal
May 3, 2024

Single user account on a shared computer can be a security issue? Using multiple user accounts in Ubuntu is a powerful way to improve both security and workflow organization. Separating work documents from personal files, restricting access to sensitive data for different users, and simplifying collaboration with colleagues. Most importantly, using a single root account […]

How to generate requirements.txt in python
March 10, 2024

A requirements.txt file is essential for managing Python project dependencies. It ensures everyone working on your project has the correct libraries installed for development and deployment. The simplest way or automatically generate requirements.txt is using piprequs library. It will generate requairements.txt file based on the imports of your project. First install the library pip install […]