Loading

Nginx入门(一):在centos上安装nginx

安装编译工具及库文件

yum install -y gcc gcc-c++ autoconf pcre pcre-devel make automake wget httpd-tools vim tree

关闭防火墙

[root@izwz9ev02los7q1d71e7muz /]# systemctl disable firewalld

确认防火墙状态

[root@izwz9ev02los7q1d71e7muz /]# systemctl status firewalld

关闭selinux

[root@izwz9ev02los7q1d71e7muz /]# setenforce 0

确认selinux状态

[root@izwz9ev02los7q1d71e7muz /]# getenforce

创建目录文件夹

[root@izwz9ev02los7q1d71e7muz /]# mkdir /soft/{code,logs,package/src} -p

确认目录情况

[root@izwz9ev02los7q1d71e7muz /]# tree /soft/

配置nginx的yum源

[root@izwz9ev02los7q1d71e7muz /]# vim /etc/yum.repos.d/nginx.repo
[nginx]
name=nginx repo
#注意:此处centeros版本根据自己实际情况配置
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=0
enabled=1

安装nginx

yum install nginx -y

安装成功,查看版本

[root@iZwz9ev02los7q1d71e7muZ ~]# nginx -v

参考:https://www.xuliangwei.com/bgx/972.html
nginx官网下载地址:http://nginx.org/en/linux_packages.html

posted @ 2019-09-02 10:19  Createsequence  阅读(212)  评论(2编辑  收藏  举报