1
0
mirror of https://gitee.com/tawords/tawords-docs synced 2025-01-10 11:28:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee

no message

This commit is contained in:
程序员小墨 2021-08-18 18:32:54 +08:00
parent 385ee53ee1
commit a3ac821d10
4 changed files with 166 additions and 3 deletions

View File

@ -84,9 +84,11 @@
- [使用的第三方接口](/manual/about/third-party-interface)
- **七、内部开发文档**
- **七、背Ta单词内部开发文档**
- [安装升级向导](/manual/internal/deployment-wizard)
- [安装升级向导 官网接口](/manual/internal/deployment-wizard)
- [官网首页伪静态配置规则](/manual/internal/pseudo-static)
- [检查SSL证书过期时间[PHP]](/manual/internal/check-cert)
- **八、其他**

View File

@ -137,7 +137,7 @@
hook.beforeEach(function(content) {
var url = 'https://gitee.com/tawords/tawords-docs/blob/master/docs/' + vm.route.file;
var editHtml = '\n[📝 在Gitee上编辑当前文档](' + url + ')\n';
var editHtml = '\n\n[📝 在Gitee上编辑当前文档](' + url + ')\n\n';
var updateTimeHtml = '\n\n' + '<p align="right" style="opacity: 0.6;">更新时间:{docsify-updated}</p>' + '\n\n';

View File

@ -0,0 +1,93 @@
> 2021.08.18更新
certcheck.php
```php
<?php
// 代码来自http://4563.org/?p=6029
//需要检查的域名数组
$domains = array(
"only4.work",
"reciteword.com",
"tawords.com",
);
foreach($domains as $domain){
$result = check($domain);
echo $domain." \t\t ".$result."<br>";
}
//检测证书信息
function check($domain){
$stream_option = array(
"ssl" => array(
"capture_peer_cert_chain" => true
)
);
$stream = stream_context_create($stream_option);
$stream_client = stream_socket_client("ssl://".$domain.":443", $errno, $errstr, 20, STREAM_CLIENT_CONNECT, $stream);
if(!$stream_client){
return "发生错误,错误代码:".$errno;
}
$stream_info = stream_context_get_params($stream_client);
stream_socket_shutdown($stream_client, STREAM_SHUT_WR);
foreach ($stream_info["options"]["ssl"]["peer_certificate_chain"] as $cert) {
$cerInfo = openssl_x509_parse($cert);
if(strstr($cerInfo["extensions"]["subjectAltName"],"DNS:".$domain) != false){
return expireLeft($cerInfo['validTo_time_t']);
if($cerInfo['validTo_time_t'] - time() < 86400){
sendFTQQ($domain);
}
}else{
return "未发现该证书对应的域名:".$cerInfo["extensions"]["subjectAltName"];
}
}
}
//证书到期时间格式化
function expireLeft($exp_time){
$sec = $exp_time - time();
switch ($sec)
{
case $sec<0:
return "已过期";
break;
case $sec > 0 and $sec < 61:
return $c."秒";
break;
case $sec < 3600 and $sec > 60:
return round($c/60,0)."分钟";
break;
case $sec < 86401 and $sec > 3600:
return round($c/3600,0)."小时";
break;
case $sec > 86400:
return floor($sec/86400)."天";
break;
}
}
//方糖通知
//申请地址http://sc.ftqq.com/3.version
function sendFTQQ($domain){
// $SCKEY = "方糖KEY";
// $url = 'https://sc.ftqq.com/'.$SCKEY.'.send?desp='.urlencode($domain).'&text='.urlencode("域名证书到期通知");
// $ch = curl_init();
// curl_setopt($ch, CURLOPT_URL, $url);
// curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
// curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
// curl_setopt($ch, CURLOPT_SSLVERSION , CURL_SSLVERSION_DEFAULT);
// curl_setopt($ch, CURLOPT_POST, TRUE);
// curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
// curl_setopt($ch, CURLOPT_TIMEOUT, 10);
// curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// $result = curl_exec($ch);
// curl_close($ch);
return;
}
?>
```

View File

@ -0,0 +1,68 @@
> 使用宝塔配置
## 配置文件
删除 `|LICENSE|README.md`
```nginx
#禁止访问的文件或目录
# location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md) # 修改这一行
location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project) # 为这一行
{
return 404;
}
```
## 伪静态
> 2021.08.18更新
http跳转httpswww跳转@;访问二级域名指向网站的二级路径
```nginx
# http跳转https
if ($server_port !~ 443){
rewrite ^(/.*)$ https://$host$1 permanent;
}
# 👇www跳转@
if ($host ~* "^www\.(.*?\..*?)$") # if ($host = 'www.reciteword.com')
{
# $host = www.reciteword.com
# $1 = reciteword.com
return 301 https://$1; # https://reciteword.com$request_uri;
}
location ~ {
index index.php index.html index.htm;
# 👇访问二级域名指向网站的二级路径
# 定义一个变量用于保存正则表达式的匹配值Nginx不允许嵌套if
set $param "";
if ($http_host ~* "^(.*?)\..*?\..*?$") # if ($http_host ~* "^(.*?)\.reciteword\.com$")
{
set $param $1; # $param 是正则表达式的匹配值
}
# 定义默认指向二级路径(需要考虑首页)
set $domain "@";
if ($param != "") # 非首页
{
set $domain $param; # 指向网站的二级路径
}
# 到目前为止,已经完成获取 xx.reciteword.com 的 xx 信息了(如果是 reciteword.com 则为@
# 接下来是设置网站的 root需要考虑文档 docs 是独立的目录)
if ($domain != "docs")
{
root /www/wwwroot/tawords-server-side/$domain;
}
if ($domain = "docs")
{
root /www/wwwroot/tawords-docs/docs; # docs 为仓库 docs/ 文件夹
}
}
# autoindex on; # 自动索引(测试时使用,线上环境勿开)
```