• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
2022
博客园    首页    新随笔    联系   管理    订阅  订阅

nginx的autoindex模块 --yum源

nginx模块

nginx的autoindex模块

ngx_http_autoindex_module,作用是生成一个目录列表  #含义
## 格式
Syntax:		autoindex on | off;		# 该选项的参数
Default:	autoindex off;			# 该选项的默认值
Context:	http, server, location	# 该选项可以使用的模块
案例 (部署一个yum仓库)
#1.安装软件
[root@pingweb01 mm]# yum -y install createrepo
## 2.创建一个yum仓库目录
[root@pingweb01 mm]# mkdir /mm/yum
## 3.生成依赖
[root@pingweb01 mm]# createrepo ./yum/
[root@pingweb01 mm]# cd yum/
[root@pingweb01 yum]# ll
total 4
drwxr-xr-x 2 root root 4096 Apr 27 23:47 repodata
## 4.配置文件
[root@pingweb01 yum.repos.d]# cat /etc/nginx/conf.d/linux12mm.yum.com.conf 
server {
    listen 80;
    server_name linux12mm.yum.com;

    location / {
        root /mm/yum;
	autoindex on;
    }

}
## 5.检查nginx并启动
[root@pingweb01 yum.repos.d]# systemctl restart nginx
## 6.配置本地hosts
192.168.15.7   linux12mm.yum.com

## 7.编写yum源
[root@pingweb01 yum.repos.d]# cat yum.repo 
[nginx-yum]
name='this is a yum'
baseurl=http://linux12mm.yum.com/
gpgcheck=1
enabled=0

## 8.清除缓存并生成
[root@web01 yum.repos.d]# yum clean all 
[root@web01 yum.repos.d]# yum makecache
## 9.重新访问测试
linux12mm.yum.com

posted @ 2021-04-28 09:03  博客之记  阅读(285)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3