1.确认系统网络 ping www.baidu.com
2.确认yum可用 yum list|grep gcc
3.确认关闭iptables规则 iptables -L(查看) iptables -F (关闭) iptables -t nat -L iptables -t nat -F
4.确认停用selinux getenforce(查看) setenforce 0 (关闭selinux )
两项安装:
yum -y install gcc gcc-c++ autoconf pcre pcre-devel make automake
yum -y install wget httpd-tools vim
一次初始化:
cd /opt; mkdir app download logs work backup
vim /etc/yum.repos.d/nginx.repo 编写yum源
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
安装nginx :sudo yum install nginx
启动Nginx并设置开机自动运行
sudo systemctl start nginx.service
sudo systemctl enable nginx.service