Home >Operation and Maintenance >Linux Operation and Maintenance >Detailed explanation of examples of using yum to install Nginx in Linux

Detailed explanation of examples of using yum to install Nginx in Linux

Y2J
Y2JOriginal
2017-05-24 14:05:504064browse

This article mainly introduces you to the tutorial on how to install Nginx using yum in CentOS 7. The article gives a detailed step-by-step introduction, which has certain reference and learning value for everyone. Friends who need it Let’s take a look together below.

Preface

Because I am currently preparing a series of Docker courses, which involves installing Nginx in CentOS 7. I encountered some problems, so I thought of sharing the process summary for everyone's reference and study. Let's take a look at the detailed introduction:

When using the following command to install Nginx, it was found that the installation could not be successful.


yum install -y nginx

Needs a little processing.

Install Nginx source

Execute the following command:


rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

Install the rpm After that, we can see a file named nginx.repo in the /etc/yum.repos.d/ directory.

Install Nginx

After installing the Nginx source, you can officially install Nginx.


yum install -y nginx

Nginx default directory

Enter the command:


whereis nginx

You will see content similar to the following:


nginx: /usr/sbin/nginx /usr/lib64/nginx /etc/nginx /usr/share/nginx

The following is the default path of Nginx:

(1) Nginx configuration path: /etc/nginx/

(2) PID directory: /var/run/nginx.pid

(3) Error log :/var/log/nginx/error.log

(4) Access log:/var/log/nginx/access.log

(5) Default site directory:/usr/share /nginx/html

In fact, you only need to know the Nginx configuration path, other paths can be in /etc/nginx/nginx.conf and /etc/nginx/conf.d/default.conf Queried.

Common commands

(1) Start:


nginx

(2) Test whether the Nginx configuration is correct:


nginx -t

(3) Graceful restart:

##

nginx -s reload

This command is similar to the following command :

kill -HUP nginx进程号

Of course, Nginx can also be compiled and installed manually. The steps are relatively complicated. Generally speaking, it is relatively simple, so I won’t go into details in this article.

Summary[Related recommendations]


1.

Linux free video tutorial


2.

Boolean Education Linux Optimization Video Tutorial

3.

Linux Tutorial

4.

Teach you how to install Nginx server in Linux

5.

Introduce the wget command of Linux in detail

The above is the detailed content of Detailed explanation of examples of using yum to install Nginx in Linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn