Nginx Nginx small entry record of acquaintance and environmental preparation (a)

Pre-intellectual preparation:

  • If you do not know the server is doing, but just entered the path of the programmer, we still learn the basics first, although the document is very simple, but at least know how to learn;
  • General server environment is now basically on a Linux system, if still unfamiliar with Linux, you can learn introductory Linux on the line;
  • If you just want to simply use the link under Windows, Linux, and in fact the nature of the environment is the same, reference may be completed, thus reducing the learning Linux;

 Foreword

  Nginx is currently the fire is the fire of the server, if not understand, but at least heard of, if not heard, that it quickly began to move up, many, many tutorials, as follows:

    1.   rookie tutorial

    2.    Technical Guide fat (quite detailed, as well as video)

    3.    CSDN blog

  A lot, a lot, a Baidu know you, I will not list them here

  

  Here to see the fat before technology tutorial record it, then again, the look will not necessarily be you, be sure to DIY, just re-record it, ensure no harm, it does not, I have begun! ! !

  

The official definition:

   Nginx is a lightweight HTTP server, using event-driven asynchronous non-blocking approach framework, which allowed excellent IO performance, often used for server-side reverse proxy and load balancing.

  The fire is the fire

   Just say Nginx more fire, how to prove? We are using, you say that fire is not fire; well, by https://w3techs.com/ (the result of this site is very useful is) to go and see, in the end Zeyang:

  

 

 

   As shown above, although the second row, and see that the proportion of rejection behind much of the street, I do not know. Why not the first, I went to the first Big Brother status can not shake it. Why then the fire is still ranked second, what is superior to others:

  • Massive support for high concurrency: the use of IO multiplexing epoll. Official test Nginx can support 50,000 concurrent, but by the great God who test, the actual concurrency slightly lower than the official then the point (we do not care about);
  • Less memory consumption: in mainstream servers, Nginx is currently the smallest memory message, the Great God test, open 10 Nginx process consumes 150M memory, we can have time to compare;
  • Free Trial can be commercialized: Nginx is open source software, free trial, can be used for commercial, open-source agreement is the 2-clause BSD-like (you can check yourself to see this agreement), this characteristics, which users do not like;
  • Profile simple: configure easy to understand;
  • Middleware do very efficient: Nginx do reverse proxy, load balancing, convenient, simple, and efficient; 
  • Other: There are many, we gradually began to feel it after use;

   Well, want specific knowledge, you can go to the official web shopping, or Baidu, the next environment to build it began

Preparing the Environment

  Select three environments

  • Build your own computer is idle or find a computer or server (on your Windows computer also installed a);
  • Ali cloud ECS, there are (https://promotion.aliyun.com/ntms/act/campus2018.html), less than 10 dollars a month Student Edition, mainly very convenient (I can not enjoy, not satisfied students this condition);
  • Use virtualization software, this way I was used;

   Because most of them are now on the Linux server environment, so the Linux environment to be recorded as a precondition. I installed a virtual machine system is CentOS 7.

installation steps   

    1. system environment and some tools:  

    yum -y install gcc gcc-c ++ autoconf pcre-devel make automake # installed gcc, compiling, packaging component
    yum -y install wget httpd-tools vim # install the downloaded tools, editing tools   

         2.Nginx installation:

     Enter http://nginx.org/en/download.html View Nginx version:

    

   Release Notes:

    • Mainline version: Developer Edition, generally used for research technology, learning is not recommended for production environments;
    • Stable version: stable version, more stable, mature, proven a long time, so the production environment is recommended to use this version;
    • legacy version :历史版本,根据需要可以下载对应的版本

      3. 用Yum进行安装(Yum 是基于RPM的包管理,自动下载RPM包并安装,自动处理依赖关系,并一次性安装所有依赖的软件包):

    1. 先查看yum源中是否有自己想要对应版本
yum list | grep nginx

  

 

     如图,我的电脑是已经配置好了。

 

        2. 如果没有或者不是自己想要的版本,那就添加yum源

    A、进入yum仓储目录下    

cd /etc/yum.repos.d/

    B、新建文件 nginx.repo

vim nginx.repo

    C、添加配置内容,官网找对应配置,或者直接找度娘就有了,以下示例中针对各种版本配置,选择适合的一个就行

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1

[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key

[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key

    D、安装  

yum install nginx

    E、检查是否安装完成,或查看对应版本

nginx -v

    如果看到Ngnix的版本信息,证明已经安装成功了 。

    

 

 

 

  

  

Guess you like

Origin www.cnblogs.com/zoe-zyq/p/11951288.html