centos7通过yum安装nginx
2018-08-31 10:33
676 查看
yum install -y nginx通过yum安装的时候提示下面的错误
[root@localhost yum.repos.d]# yum install nginx已加载插件:fastestmirror, langpacks Loading mirror speeds from cached hostfile 没有可用软件包 nginx。 错误:无须任何处理需要添加nginx的源
[root@localhost yum.repos.d]# rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm该命令执行之后,会在/etc/yum.respos.d下面多出一个nginx.repo
[root@localhost yum.repos.d]# ll总用量 40 -rw-r--r--. 1 root root 1572 12月 1 2016 CentOS-Base.repo -rw-r--r--. 1 root root 1572 12月 1 2016 CentOS-Base.repo.backup -rw-r--r--. 1 root root 1664 10月 24 10:36 CentOS-Base.repo.bak -rw-r--r--. 1 root root 1309 8月 30 2017 CentOS-CR.repo -rw-r--r--. 1 root root 649 8月 30 2017 CentOS-Debuginfo.repo -rw-r--r--. 1 root root 314 8月 30 2017 CentOS-fasttrack.repo -rw-r--r--. 1 root root 630 8月 30 2017 CentOS-Media.repo -rw-r--r--. 1 root root 1331 8月 30 2017 CentOS-Sources.repo -rw-r--r--. 1 root root 3830 8月 30 2017 CentOS-Vault.repo -rw-r--r--. 1 root root 113 7月 15 2014 nginx.repo然后再执行安装命令
yum install -y nginx安装之后,可以查看nginx的默认安装目录
[root@localhost yum.repos.d]# whereis nginxnginx: /usr/sbin/nginx /usr/lib64/nginx /etc/nginx /usr/share/nginx /usr/share/man/man8/nginx.8.gz [root@localhost yum.repos.d]# pwd/etc/yum.repos.d以下是Nginx的默认路径:(1) Nginx配置路径:/etc/nginx/(2) PID目录:/var/run/nginx.pid(3) 错误日志:/var/log/nginx/error.log(4) 访问日志:/var/log/nginx/access.log(5) 默认站点目录:/usr/share/nginx/html事实上,只需知道Nginx配置路径,其他路径均可在
/etc/nginx/nginx.conf以及
/etc/nginx/conf.d/default.conf中查询到nginx相关的验证命令及启动命令
[root@localhost yum.repos.d]# nginx [root@localhost yum.repos.d]# nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful [root@localhost yum.repos.d]# nginx -s reloadnginx 启动nginx -t 测试命令nginx -s relaod 修改nginx.conf之后,可以重载
相关文章推荐
- Centos6.5 通过yum安装nginx及配置
- centos7下通过yum安装nginx及配置
- 如何在CentOS 6上通过YUM安装Nginx和PHP-FPM
- 如何在CentOS 6上通过YUM安装Nginx和PHP-FPM
- 如何在CentOS 6上通过YUM安装Nginx和PHP-FPM
- 在centos上通过yum安装PHP+Nginx+Mysql+phpmyadmin
- Centos通过yum方式安装nginx
- CENTOS 上通过YUM安装NGINX
- 如何在CentOS 6上通过YUM安装Nginx和PHP-FPM
- Centos 6.9 通过yum安装NGINX 1.12.2 + 直接解压安装TOMCAT 8.5 + 通过yum安装Mysql 5.7
- 如何在CentOS 6上通过YUM安装Nginx和PHP-FPM
- CentOS 6.5 通过yum安装nginx
- centos7 通过YUM安装 PHP7 NGINX1.1.8 POSTGRESQL9.5
- 在centos6.5 上通过yum安装nginx和php-fpm
- centos6.5通过yum安装nginx
- centos通过yum安装php7,mysql5.7,nginx
- 如何在CentOS 6上通过YUM安装Nginx和PHP-FPM
- MySQL运维(6) Centos中通过yum命令安装MySQL5.7
- Centos6.8通过yum安装mysql5.7
- CentOS6.5下 yum 安装 Nginx