LinuxEye开源镜像站运营
技术在于折腾,最近手上有空闲国内服务器资源,于是忍不住折腾,为了方便广大开源爱好者下载Linux发行版,Linux运维笔记自己搭建了一个镜像网站。
LinuxEye开源镜像站网址:http://mirrors.linuxeye.com/
原本准备像mirrors.ustc.edu.cn镜像整个包,但是服务器磁盘容量有限,于是LinuxEye只收录最新版本(mini)的策略,镜像定期更新获取最新版本的Linux发行版,并自动替换所在目录,包含对应md5值
ps:如果大家有什么特别需要的发行版,请回帖,可以考虑加到镜像站中,谢谢!
LinuxEye开源镜像站搭建过程
1. 使用《lnmp一键安装包》,安装lnmp,执行vhost.sh 添加虚拟主机mirrors.linuxeye.com
2. 在nginx中添加fancyindex模块实现漂亮的索引目录
- cd lnmp/src
- wget http://gitorious.org/ngx-fancyindex/ngx-fancyindex/archive-tarball/master
- tar xvzf master
- # /usr/local/nginx/sbin/nginx -V #查看nginx已经编译参数
- cd nginx-1.6.2
- make clean
- #增加ngx-fancyindex模块(--add-module=../ngx-fancyindex-ngx-fancyindex)
- ./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module \
- --with-http_spdy_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module \
- --with-http_flv_module --with-ld-opt=-ljemalloc --add-module=../ngx-fancyindex-ngx-fancyindex
- make
- mv /usr/local/nginx/sbin/nginx{,_`date +%F`}
- cp objs/nginx /usr/local/nginx/sbin
3. 修改虚拟主机配置文件(/usr/local/nginx/conf/vhost/mirrors.linuxeye.com.conf)
- server {
- listen 80;
- server_name mirrors.linuxeye.com;
- access_log off;
- index index.html index.htm index.php;
- root /home/wwwroot/mirrors.linuxeye.com;
- location / {
- fancyindex on;
- fancyindex_exact_size off;
- fancyindex_localtime on;
- fancyindex_footer "/footer.html";
- fancyindex_ignore "footer.html" "exclude_centos.list";
- }
- }
参数解释:
fancyindex on:开启fancy索引
fancyindex_exact_size off:不使用精确的大小,使用四舍五入,1.9M会显示为2M这样.如果开启的话,单位为字节
fancyindex_localtime on:使用本地时间
fancyindex_footer /footer.html:把网站根目录下footer.html内容作为底部.文件不存在底部会出现404
footer.html内容如下:
- <div id="footer">
- <div id="copyright">
- 版权所有 © copy; 2015 LinuxEye div>
- div>
fancyindex_ignore:哪些文件/目录隐藏掉
fancy指令使用:
fancyindex
语法: *fancyindex* [*on* | *off*]
默认值: fancyindex off
配置块: http, server, location
描述: 开启/关闭目录索引功能
fancyindex_css_href
语法: *fancyindex_css_href uri*
默认值: fancyindex_css_href ""
配置块: http, server, location
描述: 外置css路径,可以用这个css替代掉现有的css样式
fancyindex_exact_size
语法: *fancyindex_exact_size* [*on* | *off*]
默认值: fancyindex_exact_size on
配置块: http, server, location
描述: 定义如何显示文件的大小,默认是on,on:文件大小使用精确值,单位为字节.off:单位为KB,MB,GB,如果含有小数点,将会四舍五入。例如1.9MB,将会显示为2MB。
fancyindex_footer
语法: *fancyindex_footer path*
默认值: fancyindex_footer ""
配置块: http, server, location
描述: 指定哪个文件嵌入到索引页面的底部
fancyindex_header
语法: *fancyindex_header path*
默认值: fancyindex_header ""
配置块: http, server, location
描述: 指定哪个文件嵌入到索引页面的头部.用法和fancyindex_footer类似
fancyindex_ignore
语法: *fancyindex_ignore string1 [string2 [… stringN]]*
默认值: No default.
配置块: http, server, location
描述: 哪些文件/目录隐藏掉,支持nginx正则
fancyindex_localtime
语法: *fancyindex_localtime* [*on* | *off*]
默认值: fancyindex_localtime off
配置块: http, server, location
Description: 使用当地时间显示文件的创建时间,默认是off(GMT时间)
4. 同步ustc centos镜像
- mkdir-p/home/wwwroot/mirrors.linuxeye.com/centos
- tmux#后台同步
- rsync-avrtrsync://mirrors.ustc.edu.cn/centos/\
- --exclude-from=/home/wwwroot/mirrors.linuxeye.com/exclude_centos.list\
- /home/wwwroot/mirrors.linuxeye.com/centos/
推荐阅读
-
Linode 12周年,从Xen迁移到KVM
12周岁的时候,Linode正式宣布退出给予Xen虚拟的VPS平台,推出基于KVM虚拟的VPS。从现在开始用户已经在系统后台可以选...
-
Tomcat日志切割(logrotate)
logrotate是个强大的系统软件,它对日志文件有着一套完整的操作模式,譬如:转储、邮件和压缩等,并且默认logrotate加到...
-
server.xml引入子文件配置(tomcat虚拟主机)
在配置tomcat虚拟主机时候,如何每一个虚拟主机写成单独文件,server.xml包含这些子文件?如以下《OneinStack...
-
Nginx泛解析的匹配域名绑定到子目录配置
网站的目录结构为:# tree /home/wwwroot/linuxeye.com/home/wwwroot/linuxeye....
-
制作PHP的RPM包教程
有时候为了方便源码包的安装,我们需要自己订制软件包的需求,我们会把一些源码包按照我们的需求来做成rpm包,当有了源码包就可以直接编...
-
CentOS7 Firewall防火墙详解
FirewallD提供了支持网络/防火墙区域(zone)定义网络链接以及接口安全等级的动态防火墙管理工具。它支持IPv4,I...
-
Nginx下Redmine2.6配置
Apache下Redmine2.6配置,请参考://linuxeye.com/405.html,CentOS6.6下安装Redmi...
-
Supervisor管理hhvm进程
-
LinuxEye开源镜像站运营
技术在于折腾,最近手上有空闲国内服务器资源,于是忍不住折腾,为了方便广大开源爱好者下载Linux发行版,Linux运维笔记自己搭建...
-
Python多线程抓取代理服务器
Python作为一门功能强大的脚本语言来说,经常被用来写爬虫程序,下面是Python爬虫多线程抓取代理服务器。年前是用//lin...