白嫖5T空间Onedrive并搭建下载站

更好的阅读体验欢迎访问博客白嫖5T空间Onedrive并搭建下载站php

前言

白嫖一个微软E5帐号不只能本身使用office全家桶,还能造福25个小伙伴,何乐而不为?这里借助onedirve的API和oneindexN项目搭建一个5T空间的公共下载站。html

1、得到E5帐号

打开Microsoft 365开发者中心点击当即加入,登录或注册便可。mysql

公司和语言随便填写,填写信息时请自备上网工具,若是出现“因为存在大量请求,此服务暂时不可用”提示,须要换个时间或者换个帐号再试。nginx

注册完成后打开OneDrive管理中心的存储管理git

Onedrive管理

将默认存储改成5012G,若是提示“OneDrive 上设置文件所耗的时间与预期的长请尝试关闭此页面”,也须要换个时间或者换个帐号再试。github

这样,就有了5T空间的OneDrive。开发者帐号能够分配25个子帐号,每一个帐号都有5T的OneDrive以及Office全家桶无偿使用,只须要调用API续期帐号便可。通常每90天左右续期,搭建下载站使用的的OneindexN能够实现。web

2、配置环境

首先安装nginx web服务器redis

使用rpm命令安装nginxsql

rpm -ivh http://nginx.org/packages/centos/7/x86_64/RPMS/nginx-1.18.0-1.el7.ngx.x86_64.rpm

完成后输入命令启动nginxapache

systemctl start nginx

在浏览器输入服务器公网IP检查是否出现Welcome to nginx!

Welcome to nginx!

将nginx设置为开机自启

systemctl enable nginx

至此,nginx web服务器搭建完成

而后安装PHP

安装EPEL(Extra Packages for Enterprise Linux)源

yum install epel-release

安装WEBTATIC 源

rpm -ivh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

安装PHP及其扩展

yum install php71w php71w-fpm \
php71w-cli php71w-common php71w-devel php71w-gd \
php71w-pdo php71w-mysql php71w-mbstring php71w-bcmath \
php71w-pecl-redis

启动PHP

systemctl start php-fpm

输入命令查看php是否开启

ps -ef | grep php

若是开启会有如下代码

PHP启动检查

将PHP设置为开机自启

systemctl enable php-fpm

至此,所需环境已配置完成!

3、搭建下载站

建立站点目录

mkdir -p /var/www/test.alsaces.top

其中的"test.alsaces.top"为使用的域名,也可以使用IP

下载OneIndexN

cd /var/www/test.alsaces.top
wget https://github.com/xieqifei/OneindexN/archive/v2.0.zip

解压

yum install unzip
unzip v2.0.zip

将解压出的文件移动到站点根目录

mv /var/www/test.alsaces.top/OneindexN-2.0/* /var/www/test.alsaces.top
rm -rf OneindexN-2.0 && rm -f v2.0.zip

建立站点的nginx配置文件

cd /etc/nginx/conf.d
vim test.alsaces.top.conf

按下键盘的ESC建后输入":wq"退出并保存文件

将默认配置文件的内容复制到站点配置文件

cat default.conf > test.alsaces.top.conf

修改配置文件

vim test.alsaces.top.conf

按下i键编辑,将" server_name"一行改成

server_name  test.alsaces.top;

将"location /"及其括号内的内容改成改成

location / {
        root   /var/www/test.alsaces.top;
        index  index.html index.htm index.php;
    }

其中的"/var/www/test.alsaces.top"为网站根目录

将"location ~ .php$"及其括号内的内容取消注释

location ~ \.php$ {
        root           html;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  /var/www/test.alsaces.top$fastcgi_script_name;
        include        fastcgi_params;
    }

其中的"/var/www/test.alsaces.top"为网站根目录

完成后按下ESC键后输入":wq"回车保存退出文件

重载nginx

systemctl reload nginx

修改php配置文件

vim /etc/php-fpm.d/www.conf

将其中的"user = apache"改成

user = nginx

将其中的"group = apache"改成

group = nginx

完成后按下ESC键后输入":wq"回车保存退出文件

重载php

systemctl reload php-fpm

访问使用的域名或者IP查看是否正常,正常可获得如下界面

OneindexN界面

接下来点击下一步后再点击获取应用ID和机密

登录后复制并填入应用机密栏中,以后点击返回快速启动

应用机密

在新界面中找到”App ID (or Client ID)“,复制其内容并填入到应用ID栏中

应用ID

以后绑定E5帐号并赞成受权便可

安装完成

至此,下载站搭建完成!下载文件务必使用多线程下载工具!

参考文章:

经过yum安装Nginx

CentOS 7 yum 安装 PHP 7.1

nginx安装配置、Nginx支持php

报错:directory index of “xxx“ is forbidden