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 reload

nginx   启动

nginx -t  测试命令

nginx -s relaod 修改nginx.conf之后,可以重载

转载于:https://blog.51cto.com/13293070/2167237

centos7通过yum安装nginx相关推荐

  1. CentOS7使用yum安装Nginx

    CentOS7使用yum安装Nginx 文章目录 CentOS7使用yum安装Nginx 安装说明 安装gcc 安装pcre库 安装zlib库 安装OpenSSL库 安装Nginx库 启动nginx ...

  2. centos7 nginx配置php7,centos7下yum安装nginx和php7和php-fpm

    安裝 nginxCentOS 7 沒有內建的 nginx,所以先到 nginx官網 http://nginx.org/en/linux_packages.html ,找到 CentOS 7 的 ngi ...

  3. centos7通过yum安装nginx以及其简单配置使用

    干货!干货!干货! 执行命令: $ yum install -y nginx 通过yum安装的时候提示下面的错误: [root@localhost ~]# yum install nginx 已加载插 ...

  4. 【CNMP系列】CentOS7.0下安装Nginx服务

    [CNMP系列]CentOS7.0下安装Nginx服务 话步前言,CNMP之路,系统起步:http://www.cnblogs.com/riverdubu/p/6425028.html 这回我来讲解下 ...

  5. CentOS下yum安装nginx服务

    添加nginx的yum源 rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ng ...

  6. CentOS7用yum安装软件报:Cannot find a valid baseurl for repo: base/7/x86_64

    CentOS7用yum安装软件报:Cannot find a valid baseurl for repo: base/7/x86_64 问题:Cannot find a valid baseurl ...

  7. centos7 go yum 安装_超详细的centos7下载安装Postgresql11(yum安装)教程

    概述 新项目准备用PG数据库,实际上也是练手用的,后面用好了再做mysql到PG的迁移,今天主要记录一下centos7用yum安装Postgresql11的过程. 1.到官网查看yum支持到哪个版本的 ...

  8. linux下yum安装pgsql,CentOS7使用yum安装PostgreSQL和PostGIS的方法

    1.更新yum源 CentOS7默认yum源的PostgreSQL版本过低,不适合在本版本上使用.在https://yum.postgresql.org/repopackages.php上找到适合Ce ...

  9. Centos7通过yum安装jdk8

    1.Centos7通过yum安装jdk8 2.Centos7通过yum安装jdk8 转载于:https://www.cnblogs.com/linjiqin/p/11459529.html

最新文章

  1. getElementById取得文本框中的值
  2. HALCON示例程序vessel.hdev血管的分割与测量
  3. ubuntu分解压缩包
  4. 行政区域村级划分数据库_最新行政区划代码省市区三级 乡镇街道四级 村五级 数据库(2020年11月版 )...
  5. tipask二次开发总结_二次开发自我总结
  6. Java中需要全部小写的是,java – 如何处理JSR 310中的大写或小写?
  7. u盘最大单个文件支持多少g_小身材用处大,金属U盘功能不简单
  8. delphi remobjects
  9. Quartus安装破解失败试了一些方法汇总
  10. 模型预测控制的缺点_一个模型预测控制(MPC)的简单实现
  11. 理论+示例,三个问题系统捋清UGC平台的玩法
  12. 在ESP32/ESP8266上使用MicroPython利用MQTT发布BME280传感器数据(温度,湿度和压力)
  13. ps计算机图片素材,电脑ps怎么把图片变清晰(手把手教你修图)
  14. Qt构建时出现Makefile Error 1的解决办法
  15. 电影《检察风云》投资价值简单分析
  16. ip地址转换htonl的用法
  17. java day1 Markdown学习,Windows常用快捷键及常见的dos命令
  18. C语言程序设计第三版崔武子,清华大学出版社-图书详情-《C语言程序设计教程学习辅导》...
  19. 污水处理厂不仅能“喝”啤酒,还能“穿”绿衣,“吃”糖果
  20. 访问控制的三种模型(DAC、MAC、RBAC)

热门文章

  1. Java中classpath配置
  2. iframe中请求页面而session失效时页面跳转问题
  3. Java 调用Oracle的存储过程
  4. Devexpress XtraGrid 控件编辑的内容,如何实时生效
  5. Silverlight 2 Beta 2发布
  6. NO29 用户提权sudo配置文件详解实践--志行为审计
  7. 需求旺盛:市场提供大量机器学习与物联网相关岗位
  8. 如何在 Linux 上录制你的终端操作
  9. Css Font 详细研究
  10. 一致性哈希算法及其在分布式系统中的应用