centos7通过yum安装nginx
nginx不支持centos7通过yum直接安装~~~
1、查看操作系统位数
[[email protected] ~]# rpm -aq|grep centos-release
centos-release-7-4.1708.el7.centos.x86_64/
2、创建nginx的yum源
[[email protected] ~]# cat /etc/yum.repos.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/x86_64/
gpgcheck=0
enabled=1
注意:上面的x86_64改为你自己的操作系统位数。
3、yum命令安装
[[email protected] ~]# yum install -y nginx
4、启动服务
[[email protected] ~]# service nginx start
或者
[[email protected] ~]# systemctl start nginx
Redirecting to /bin/systemctl start nginx.service
You have new mail in /var/spool/mail/root
5、查看端口默认为80
[[email protected] ~]# ss -lntp|grep 80
LISTEN 0 128 *:80 *:* users:(("nginx",pid=23806,fd=6),("nginx",pid=23805,fd=6))
6、发布路径
[[email protected] ~]#/usr/share/nginx/html/
访问: http://IP
原文地址:https://www.cnblogs.com/Dev0ps/p/9369134.html