Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install Nginx with yum in CentOS 7

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Preface

Because recently, a series of Docker courses have been prepared, which involve installing Nginx in CentOS 7. Encounter some problems, so want to share the process summary for your reference and study, let's take a look at the detailed introduction:

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

Yum install-y nginx

It needs to be done a little bit.

Install the 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

After installing the rpm, we can see a file called 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 can see something similar to the following:

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

The following is the default path for 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, as long as you know the Nginx configuration path, other paths can be queried in / etc/nginx/nginx.conf and / etc/nginx/conf.d/default.conf.

Common command

(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 process number

Of course, Nginx can also be compiled and installed manually, the steps are relatively cumbersome, generally speaking, it is relatively simple, and I will not repeat them in this article.

Summary

The above is the whole content of this article, I hope that the content of this article can bring some help to your study or work, if you have any questions, you can leave a message and exchange, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report