Nginx Tutorial (1): Basic concepts

Source: Internet
Author: User
Tags what is nginx
(click the public number above for a quick follow-up)


English: Netguru, translation: Open source China

Www.oschina.net/translate/nginx-tutorial-basics-concepts



Introduction


Hey. Sharing is caring. So, we are willing to share a little bit of knowledge with you. We have prepared this "Nginx tutorial" divided into the sections. If you already know something about Nginx, or if you want to know more, this tutorial will be very helpful.


We'll show you how Nginx works, what the concept behind it is, and how to optimize it to improve the performance of your application. will also show you how to install, how to start, run.


This tutorial includes the following sections:


Basic concepts-you can see the difference between commands (Directive) and the environment (context), inheritance patterns, and the order in which Nginx chooses server chunks, as well as the installation location.

Performance management-The know-how to increase speed. We'll explain the gzip, cache, buffer, and timeout settings.

SSL Settings-explains the steps for setting up content with HTTPS.


Our goal is to create a series of tutorials that allow you to easily find the right configuration for a specific topic, such as gzip, SSL, or simply browse through those configurations. For the best learning experience, we recommend that you install Nginx on your own machine and do the actual work in your own hands.


what is Nginx.


Nginx was originally created as a Web server to solve c10k problems. As a WEB server, it can serve your data at an alarming rate. But Nginx is not just a WEB server, you can also use it as a reverse proxy to easily integrate with slower upstream servers such as Unicorn or Puma. You can properly allocate traffic (load balancer), stream media, dynamically resize images, cache content, and so on.


The basic Nginx architecture consists of the master process and its worker processes. Master reads the configuration file and maintains the worker process, while the worker actually processes the request.


Basic Commands


To start Nginx, simply enter:


[Sudo] Nginx


When your Nginx instance is running, you can manage it by sending the appropriate signal:


[Sudo] nginx-s signal


Available signals:


stop– Quick Close

quit– Graceful shutdown (wait for the worker thread to finish processing)

reload– Overloaded configuration files

reopen– Reopen log file
directives and contexts


Nginx configuration file, the default location includes:


/etc/nginx/nginx.conf,

/usr/local/etc/nginx/nginx.conf, or

/usr/local/nginx/conf/nginx.conf


The configuration file is composed of the following sections:


directive – optional, containing the name and parameters, ending with a semicolon


gzip on;


Context – chunking, you can declare an instruction – similar to a scope in a programming language


Worker_processes 2; # Global Context Directives

HTTP {# HTTP context

gzip on; # directives in the HTTP context

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.