Nginx 安装

Nginx安装

1.关闭防火墙与SElinux

[root@nginx ~]# systemctl stop firewalld
[root@nginx ~]# systemctl disable firewalld
[root@nginx ~]# getenforce
Disabled

新添加。。。。。。

1.基本安装包

[root@nginx ~]# yum install -y gcc gcc-c++ autoconf pcre pcre-devel make automake wget httpd-tools vim tree

2.编辑yum文件

[root@nginx yum.repos.d]# vim nginx.repo

添加以下内容:

[nginx] name=nginx repo baseurl=http://nginx.org/packages/centos/7/$basearch/ gpgcheck=1 enabled=1 gpgkey=https://nginx.org/keys/nginx_signing.key

进行yum安装
[root@nginx ~]# yum -y install nginx

3.查看Nginx当前版本

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

4.启动Nginx
[root@nginx ~]# systemctl restart nginx
[root@nginx ~]# systemctl enable nginx

查看端口号

[root@nginx ~]# netstat -ntulp |grep :80
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 5217/nginx: master

posted @ 2021-12-17 17:12  ITxiaomage  阅读(43)  评论(1编辑  收藏  举报