LNMP-Nginx安装

1、环境准备

1.1、参考章节

1.2、配置官方yum仓库

cat >/etc/yum.repos.d/nginx.repo<<'EOF'
[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
EOF

2、安装nginx

2.1、安装

yum install nginx -y

2.2、配置Nginx进程运行用户

groupadd -g 666 www
useradd -u 666 -g 666 www
sed -i '/^user/c user www;' /etc/nginx/nginx.conf

2.3、启动nginx且设置开机自启动

systemctl start nginx
systemctl enable nginx

 

posted @ 2023-04-27 23:04  小粉优化大师  阅读(30)  评论(0编辑  收藏  举报