本文章为转载:https://blog.csdn.net/lisheninasiainfo/article/details/53576038
下载 nginx的rpm包
wget http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
建立nginx的yum仓库
[root@localhost conf.d]# rpm -ivh nginx-release-centos-7-0.el7.ngx.noarch.rpm
下载并安装nginx
yum install nginx
然后会尝试个站点的镜像,163镜像下载安装
启动nginx服务
systemctl start nginx
查看以下nginx的进程:
[root@localhost conf.d]# ps aux |grep nginx
root 14631 0.0 0.0 48552 1032 ? Ss 22:18 0:00 nginx: master process nginx -c /etc/nginx/nginx.conf
nginx 14633 0.0 0.0 51100 2556 ? S 22:18 0:00 nginx: worker process
root 15040 0.0 0.0 112704 956 pts/2 S+ 22:24 0:00 grep --color=auto nginx
查看nginx版本信息和相关的配置参数
# nginx -V
系统的nginx的service文件在 /lib/systemd/system
用户的nginx的service文件在 /usr/lib/systemd/system
systemctl enable nginx.service
这样就可以配置开机自起了
本站文章如无特殊说明,均为本站原创,如若转载,请注明出处:centos7 nginx安装及自启动 - Python技术站