安装教程安装LNMP失败。
逐个单独安装。
1.创建repo源文件
cd /etc/yum.repos.d
touch nginx.repo
2.在nginx.repo文件中添加以下内容:
[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
module_hotfixes=true
[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
3.查看源是否修改成功
yum info nginx
4.安装nginx
yum install nginx -y
5.启动nginx
systemctl start nginx #启动
systemctl enable nginx #开机自动启动
6.其他命令
systemctl reload nginx
systemctl stop nginx
ps -ef |grep nginx #查看nginx进程
service --status-all #查看所有服务状态
7.nginx目录结构(linux)
主程序: /usr/sbin/nginx
存放配置文件:/etc/nginx
存放静态文件:/usr/share/nginx
存放日志 : /var/log/nginx