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

Y2J
Release: 2017-05-24 14:05:50
Original
4051 people have browsed it

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
Copy after login
Copy after login

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
Copy after login

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
Copy after login
Copy after login

Nginx default directory

Enter the command:


whereis nginx
Copy after login

You will see content similar to the following:


nginx: /usr/sbin/nginx /usr/lib64/nginx /etc/nginx /usr/share/nginx
Copy after login

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
Copy after login

(2) Test whether the Nginx configuration is correct:


nginx -t
Copy after login

(3) Graceful restart:

##

nginx -s reload
Copy after login

This command is similar to the following command :

kill -HUP nginx进程号
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template