«

CentOS 7 yum源安装Nginx

指尖二进制 • 1 年前 • 716 次点击 • NGINX


先安装nginx的yum源和163源
nginx源:用于安装nginx
163源:用于安装依赖openssl环境

[root@bogon ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo
[root@bogon ~]# rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

清理、生成新的缓存

[root@bogon ~]# yum clean all && yum makecache

查看nginx最新版本

[root@bogon ~]# yum info nginx
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Available Packages
Name        : nginx
Arch        : x86_64
Epoch       : 1
Version     : 1.14.1
Release     : 1.el7_4.ngx
Size        : 753 k
Repo        : nginx/x86_64
Summary     : High performance web server
URL         : http://nginx.org/
License     : 2-clause BSD-like license
Description : nginx [engine x] is an HTTP and reverse proxy server, as well as
            : a mail proxy server.

安装

[root@bogon ~]# yum install nginx

启动

[root@bogon ~]# systemctl start nginx
[root@bogon ~]# systemctl status nginx

查看进程

[root@bogon ~]# ps -ef|grep nginx|grep -v grep
root       9671      1  0 02:15 ?        00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
nginx      9672   9671  0 02:15 ?        00:00:00 nginx: worker proces

查看版本 (-V 查看模块)

[root@bogon ~]# nginx -v
nginx version: nginx/1.14.1

查看端口

[root@bogon ~]# netstat -apntl|grep nginx
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      9671/nginx: master
还没收到回复