Coder Social home page Coder Social logo

mnestorov / nginx-commands Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 19 KB

These list of Nginx commands should help you better understand and manage Nginx commands based on their functionality.

nginx nginx-configuration nginx-config nginx-server nginx-commands

nginx-commands's Introduction

Nginx Commands

Licence

Overview

These list of Nginx commands should help you better understand and manage Nginx commands based on their functionality.

Starting and Stopping Nginx

Configuration Management

Logging and Monitoring

Process Management

Boot Configuration

Help and Version Information

Configuration File Management


Starting and Stopping Nginx

Start Nginx

sudo nginx

For systemd (Ubuntu 16.04 LTS and above):

sudo systemctl start nginx

Stop Nginx

Stopping Nginx will kill all system processes quickly. This will terminate Nginx even if there are open connections. In order to do so, run one of the following commands:

sudo nginx -s stop

For systemd (Ubuntu 16.04 LTS and above):

sudo systemctl stop nginx

Restart Nginx

sudo service nginx restart

For systemd (Ubuntu 16.04 LTS and above):

sudo systemctl restart nginx

Reload Nginx

sudo nginx -s reload

For systemd (Ubuntu 16.04 LTS and above):

sudo systemctl reload nginx

Quit Nginx

sudo nginx -s quit

Check Nginx status

sudo service nginx status

For systemd (Ubuntu 16.04 LTS and above):

sudo systemctl status nginx

Configuration Management

Reload Nginx configuration

sudo nginx -s reload

For systemd (Ubuntu 16.04 LTS and above):

sudo systemctl reload nginx

Test Nginx configuration for syntax errors

sudo nginx -t

Start Nginx with a custom configuration file

sudo nginx -c /path/to/custom/nginx.conf

Start Nginx with a custom error log file

sudo nginx -e /path/to/custom/error.log

Start Nginx with a custom global configuration prefix

sudo nginx -p /path/to/custom/prefix

Set a custom worker process count

sudo nginx -g "worker_processes COUNT;"

Logging and Monitoring

View Nginx error logs

sudo tail -f /var/log/nginx/error.log

View Nginx access logs

sudo tail -f /var/log/nginx/access.log

Display active Nginx connections

sudo nginx -V 2>&1 | grep -o with-http_stub_status_module

Process Management

Display Nginx process ID (PID)

sudo cat /run/nginx.pid

Send a signal to a specific Nginx process

sudo kill -s SIGNAL PID

Boot Configuration

Enable Nginx auto-start at boot

sudo systemctl enable nginx

Disable Nginx auto-start at boot

sudo systemctl disable nginx

Help and Version Information

Display Nginx version and configuration options

nginx -V

Display help information

nginx -h

Configuration File Management

Create a temporary backup of the Nginx configuration

sudo cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.backup

Restore a backup of the Nginx configuration

sudo cp /etc/nginx/nginx.conf.backup /etc/nginx/nginx.conf

Open the main Nginx configuration file with a text editor

sudo nano /etc/nginx/nginx.conf

Open a specific server block configuration file with a text editor

sudo nano /etc/nginx/sites-available/your_server_block

Create a symbolic link to enable a server block

sudo ln -s /etc/nginx/sites-available/your_server_block /etc/nginx/sites-enabled/

Remove a symbolic link to disable a server block

sudo rm /etc/nginx/sites-enabled/your_server_block

License

This repository is unlicense[d], so feel free to fork.

nginx-commands's People

Contributors

mnestorov avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.