Zdir数据站点安装教程

更新时间:2021-07-20 14:56:52

访问次数:1594

详细介绍

安装Zdir


常规安装


Zdir数据站点安装教程

  1. 访问 zdir.zip 下载最新源码,并解压到站点根目录。

  2. config.simple.php修改为config.php

  1. 修改config.php 文件,设置网站关键词、描述等、密码等

  2. 访问您的域名测试,文件管理用户名为zdir,密码为config.php中设置的密码


源码备用下载地址https://dwz.ovh/zdirdown


安装在子目录(推荐)


v1.50版本开始,Zdir支持安装在子目录运行,比如您的站点目录为/data/wwwroot/default,您可以将Zdir源码放在/data/wwwroot/default/zdir安装在子目录需要设置伪静态才能正常运行。

Nginx伪静态

  • 需要个将默认首页设置为zdir/index.php,比如index zdir/index.php index.html index.htm index.php

  • 需要在Server的配置中添加一行伪静态规则:rewrite ^/static/(.+) /zdir/static/$1 break;


下方是一个示例配置:

server {
  listen 80;
  server_name localhost;
  #access_log /var/log/zdir.log combined;
  index zdir/index.php index.html index.htm index.php;
  root /data/wwwroot/default;

  #rewrite
  rewrite ^/static/(.+) /zdir/static/$1 break;
  #error_page 404 /404.html;
  #error_page 502 /502.html;

  location ~ [^/]\.php(/|$) {
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index index.php;
    include fastcgi.conf;
  }

  location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
    expires 30d;
    access_log off;
  }
  location ~ .*\.(js|css)?$ {
    expires 7d;
    access_log off;
  }
  location ~ /\.ht {
    deny all;
  }
}


Apache伪静态

Apache环境直接将/data/wwwroot/default/zdir/.htaccess.bak复制为/data/wwwroot/default/.htaccess即可。或者自行在站点根目录下新建一个.htaccess文件,内容为:

RewriteEngine On
DirectoryIndex zdir/index.php
RewriteRule 'static/(.*)$' zdir/static/$1 [L]

config.php设置

需要在config.php文件中将"thedir" => '',设置为您的站点根目录,比如:

"thedir"	=>	'/data/wwwroot/default',

注意:安装在子目录的方式,站点根目录不能以zdir命名,比如:/web/zdir是不允许的,应改为/web/xxx


Docker方式安装

Docker for Zdir一键部署脚本:

bash <(curl -Lsk https://raw.githubusercontent.com/helloxz/zdir/master/zdir-install.sh)

更多说明请参考:https://www.xiaoz.me/archives/14809


config.php配置文件说明


设置站点基本信息


打开config.php 配置文件


$siteinfo = array(
		"site_name"	=>	"<i class='fa fa-sitemap' aria-hidden='true'></i> xiaoz软件库",
		"title"		=>	"Zdir 实用的目录列表程序",
		"keywords"	=>	"zdir,h5ai,Directory Lister,Fdscript,目录列表,目录索引",
		"description"	=>	"Zdir是一款使用PHP开发的目录列表程序,简单实用,免费开源。"
	);


  • site_name:网站名称(左上角显示)

  • title:设置站点标题(浏览器上显示)

  • keywords:设置网站关键词

  • description:设置网站描述


排除某个目录


//需要忽略的目录
	$ignore	= array(
		".",
		".git",
		"favicon.ico",
		"functions",
		"config.php",
		"index.php",
		"static",
		"LICENSE",
		"template",
		"cache.php",
		"indexes.php"
	);


如果您需要排除某个目录,请修改上面的$ignore变量。


原本网址https://www.yuque.com/helloz/zdir/install

猜你喜欢

网友评论