h5ai优化+NGINX目录认证
官方网站:
https://larsjung.de/h5ai/
注意,_h5ai文件夹要放在你需要共享的文件夹同目录下
访问http(s)://yourdomain.xxx/_h5ai/public/index.php
查看参数。(刚安装为空密码)
使用
将/_h5ai/public/index.php
添加到默认主页里面
Nginx
index index.html index.php /_h5ai/public/index.php;//修改index一行
Apache
DirectoryIndex index.html index.php /_h5ai/public/index.php//修改DirectoryIndex一行
配置文件
_h5ai/private/conf/options.json
浏览相关
"view": {
//为true的话,用1024进制来计算文件大小
"binaryPrefix": true,
...
//隐藏名字与这些正则表达式匹配的文件/文件夹
"hidden": ["^\\.", "^_h5ai"],
...
//如果目录里存在这些文件之一则不应用 _h5ai 来管理文件
//(即用于点击目录直接打开网站之类的)
"unmanaged": ["index.html", "index.htm", "index.php"],
//是否在新窗口中打开上面提到的这种目录
"unmanagedInNewWindow": false
},
h5ai的版权链接
_h5ai/public/js/scripts.js
加密文件夹
利用Nginx web用户认证
1.安装htpasswd
ubuntu
sudo apt-get install apache2-utils
centos
yum -y install httpd-tools
新增用户
htpasswd -cm /usr/local/nginx/conf/htpasswd aiker #lnmp
htpasswd -cm /www/server/nginx/conf/htpasswd aiker #宝塔
网站伪静态设置
location ~ ^/_h5ai/private/ {
return 404;
}
location ~ ^/123/.*
{
auth_basic "please login!";
auth_basic_user_file htpasswd;
autoindex on;
}
PHP都能解析,否则PHP代码会原文下载
location ~ ^/.*
{
location ~ [^/]\.php(/|$) {
#fastcgi_pass remote_php_ip:9000;
fastcgi_pass unix:/dev/shm/php56-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
auth_basic "please login!";
auth_basic_user_file htpasswd;
autoindex on;
}
上一篇
VPS优化设置 下一篇
Win注册表启动的位置