欢迎光临!
若无相欠,怎会相见

Office 365 E5 开发者订阅搭配 VPS 安装 OneManager 自建网盘

序言

本篇文章将使用 Office 365 E5 开发者订阅搭配 VPS 安装 OneManager 自建一个网盘。

安装之前,假设已经拥有的一台能正常使用的 VPS,能正常使用表示拥有 Web 服务端,PHP等。当然我用的是 lnmp 集合包 。

注册应用

使用管理员登录微软 E5 开发者订阅 : https://admin.microsoft.com/#/homepage , 然后看图片操作:

进入 AAD 进行应用注册:

注册的时候名称随便取,重定向 URI 选择 https://scfonedrive.github.io/ , 因为 OneManager 是这样要求的,最后点击注册 。 

然后保存我们需要的信息,Client ID 等

当然,还需要 Client Secret(我将多个图片叠加到一起了),不要复制到 Secret ID,我们需要的是值:

然后设置 API 权限:

OK , 到此需要的信息已经拿到了,现在开始安装 OneManager 。

OneManager 安装

使用 lnmp 新建一个 vhost , 不需要数据库,只要能运行 PHP 代码即可 。

[root@liangz wwwroot]# lnmp vhost add
+-------------------------------------------+
|    Manager for LNMP, Written by Licess    |
+-------------------------------------------+
|              https://lnmp.org             |
+-------------------------------------------+
Please enter domain(example: www.lnmp.org): pan.liangz.org
 Your domain: pan.liangz.org
Enter more domain name(example: lnmp.org *.lnmp.org):
Please enter the directory for the domain: pan.liangz.org
Default directory: /home/wwwroot/pan.liangz.org:
Virtual Host Directory: /home/wwwroot/pan.liangz.org
Allow Rewrite rule? (y/n) y
Please enter the rewrite of programme,
wordpress,discuzx,typecho,thinkphp,laravel,codeigniter,yii2 rewrite was exist.
(Default rewrite: other):
You choose rewrite: other
Enable PHP Pathinfo? (y/n) n
Disable pathinfo.
Allow access log? (y/n) y
Enter access log filename(Default:pan.liangz.org.log):
You access log filename: pan.liangz.org.log
Create database and MySQL user with same name (y/n) n
Add SSL Certificate (y/n) n

Press any key to start create virtul host...

Create Virtul Host directory......
set permissions of Virtual Host directory......
You select the exist rewrite rule:/usr/local/nginx/conf/rewrite/other.conf
Test Nginx configure file......
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
Reload Nginx......
Reload service php-fpm  done
================================================
Virtualhost infomation:
Your domain: pan.liangz.org
Home Directory: /home/wwwroot/pan.liangz.org
Rewrite: other
Enable log: yes
Create database: no
Create ftp account: no
================================================
[root@liangz wwwroot]#

然后从 https://github.com/qkqpttgf/OneManager-php/releases 下载一个 release 版本的程序包,解压后放到上面设置的目录里面 , 比如我的在 /home/wwwroot/pan.liangz.org 。

然后修改 nginx config 文件,将 rewrite ^(.*) /index.php?/$1 last; 写入到相应的 vhost 的 conf 文件中 , 例如我的修改如下:

[root@liangz vhost]# cd /usr/local/nginx/conf/vhost/
[root@liangz vhost]# vim pan.liangz.org.conf

然后将 rewrite ^(.*) /index.php?/$1 last; 加入到 conf 文件中 。 修改域名解析后,可以直接通过域名访问并安装 OneManager 。

点击上图开始安装,下一步是选择语言,语言就自己选择了,然后让你测试伪静态,如果没通过,就是上面的一步没有完成

正常情况下,点击后直接进入密码设置页码:

密码设置完毕,点击确认后,如果出现如下错误:

请将程序代码所在的目录的所有者修改为 www:www ,例如我的修改如下:

chown -R www:www pan.liangz.org/

正常情况下,执行上面的代码之后就可以了,但是如果还是不行,那就进入程序目录,给 .data/config.php 读取写入权限:

chmod 666 .data/config.php

安装完毕之后是这样的页面:

然后点击管理添加 OneDrive ,标签与名称随便填写,但是 Client ID 和 Client Secret 必须是前文中的:

这就是为什么在申请应用的时候把 重定向 URI 选择 https://scfonedrive.github.io/ 的原因。点击确认后再用你的 E5 管理员账号确认授权就可以了。完成后的效果如下:

OK,这个网盘算是完成了

结语

可以更方便的将文件上传保存了。

如有错误,敬请指出,感谢指正!    — 2021-05-22 23:32:26

 

赞(0) 打赏
转载请注明:飘零博客 » Office 365 E5 开发者订阅搭配 VPS 安装 OneManager 自建网盘
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

欢迎光临