1.搭建准备
#0)操作系统版本
cat /etc/redhat-release
#1)关闭selinux:
setenforce 0 #临时关闭selinux
getenforce #查看临时关闭情况
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config #永久关闭,修改配置
#2)关闭防火墙
systemctl stop firewalld #关闭防火墙运行。
systemctl disable firewalld #禁止开机跟随系统启动。
2.Nginx部署
1) 使用官方仓库安装Nginx
复制代码
yum install yum-plugin-priorities -y
cat >/etc/yum.repos.d/nginx.repo<<'EOF'
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
priority=1
EOF
cat /etc/yum.repos.d/nginx.repo
复制代码
2)安装Nginx
yum remove nginx -y
yum install nginx -y
3) 配置Nginx进程运行的用户
useradd -u1111 www -s /sbin/nologin -M
sed -i '/^user/c user www;' /etc/nginx/nginx.conf
grep "^user" /etc/nginx/nginx.conf
4) 启动Nginx,并将Nginx加入开机自启
systemctl start nginx
systemctl enable nginx
netstat -lntup #查看端口对应的服务
curl 127.0.0.1 #welcome to Nginx 表示正常。
标签:架构,关闭,etc,LNMP,Nginx,systemctl,yum,nginx From: https://blog.51cto.com/u_15867943/5968593