Home>Article>Operation and Maintenance> Detailed explanation of examples of using yum to install Nginx in Linux
This article mainly introduces you to the tutorial on how to installNginx using yumin 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 ofDockercourses, 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.confQueried.
Common commands
(1) Start:nginx(2) Test whether the Nginx configuration is correct:
nginx -t(3) Graceful restart:
##
nginx -s reload
kill -HUP nginx进程号
Summary[Related recommendations]
1.
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!