服务常见问题, 站长工具

Let’s Encrypt SSL 证书验证CAA错误 Verify error:DNS problem: query timed out looking up CAA for

 

具体报错如下

[Thu Dec 10 13:10:00 CST 2020] www.526net.com:Verify error:DNS problem: query timed out looking up CAA for www.526net.com
[Thu Dec 10 13:10:00 CST 2020] Please check log file for more details: /usr/local/acme.sh/acme.sh.log
Let’s Encrypt SSL Certificate create failed!

 

在你的dns解析服务商那里添加相应的CAA解析。比如下面是我的。

主机记录 记录类型  记录值 
blog         CAA         1 issue letsencrypt.org

php

重建(替换)一些被 PHP7 废弃的函数

 

重建(替换)一些被 PHP7 废弃的函数
<?php
if(!function_exists(‘ereg’)) { function ereg($pattern, $subject, &$matches = []) { return preg_match(‘/’.$pattern.’/', $subject, $matches); } }
if(!function_exists(‘eregi’)) { function eregi($pattern, $subject, &$matches = []) { return preg_match(‘/’.$pattern.’/i’, $subject, $matches); } }
if(!function_exists(‘ereg_replace’)) { function ereg_replace($pattern, $replacement, $string) { return preg_replace(‘/’.$pattern.’/', $replacement, $string); } }
if(!function_exists(‘eregi_replace’)) { function eregi_replace($pattern, $replacement, $string) { return preg_replace(‘/’.$pattern.’/i’, $replacement, $string); } }
if(!function_exists(‘split’)) { function split($pattern, $subject, $limit = -1) { return preg_split(‘/’.$pattern.’/', $subject, $limit); } }
if(!function_exists(‘spliti’)) { function spliti($pattern, $subject, $limit = -1) { return preg_split(‘/’.$pattern.’/i’, $subject, $limit); } }

 

温馨提示
有些地方替换函数中的 / 可能会报错,可以将 / 换成 ~,比如:

return preg_match(‘/’.$pattern.’/i’, $subject, $matches); 改为: return preg_match(‘~’.$pattern.’~i’, $subject, $matches);

愚人愚语

勇者斗恶龙

困难重重

linux

Debian10 安装远程桌面,添加exe支持 挂QQ

安装桌面
tasksel
选择要安装的桌面
重启

安装 XRDP 远程桌面服务
1.安装XRDP和TigerVNC服务器
sudo apt-get install xrdp tigervnc-standalone-server
2.启动XRDP服务并加入自启动
systemctl start xrdp
systemctl enable xrdp
3.设置允许启用X服务器的用户(请勿设置为root根目录用户,非常不安全)
dpkg-reconfigure xserver-xorg-legacy

安装 wine

添加32位支持
sudo dpkg –add-architecture i386

更新系统 安装依赖
sudo apt update
sudo apt -y install gnupg2 software-properties-common
wget -qO – https://dl.winehq.org/wine-builds/winehq.key | sudo apt-key add -
sudo apt-add-repository https://dl.winehq.org/wine-builds/debian/

Debian 10:

wget -O- -q https://download.opensuse.org/repositories/Emulators:/Wine:/Debian/Debian_10/Release.key | sudo apt-key add –
echo "deb http://download.opensuse.org/repositories/Emulators:/Wine:/Debian/Debian_10 ./" | sudo tee /etc/apt/sources.list.d/wine-obs.list

Debian 9:

wget -O- -q https://download.opensuse.org/repositories/Emulators:/Wine:/Debian/Debian_9.0/Release.key | sudo apt-key add –
echo "deb http://download.opensuse.org/repositories/Emulators:/Wine:/Debian/Debian_9.0 ./" | sudo tee /etc/apt/sources.list.d/wine-obs.list

#安装wine 稳定版本
sudo apt update
sudo apt install –install-recommends winehq-stable

//安装其他版本
sudo apt install –install-recommends winehq-devel
sudo apt install winehq-staging

查看版本
$ wine –version
wine-5.0

查看帮助
$ wine –help

运行例子:
$ cd ~/Downloads
$ wget https://notepad-plus-plus.org/repository/7.x/7.7/npp.7.7.Installer.exe
$ wine ./npp.7.7.Installer.exe

配置中文环境
首先我们添加对中文的支持:
sudo apt-get install locales

然后然后配置 locales 软件包:
sudo dpkg-reconfigure locales

用方向键移动,空格键选择,Tab 键切换位置。
zh_CN 开头的都选上

安装wine时,因为缺少了中文字体,所以中文字体有时会显示为方框。在这里,我给出一种解决方案。

第一步:下载想要的字体,比如宋体simsum.ttc。

下载链接:https://github.com/sonatype/maven-guide-zh/raw/master/content-zh/src/main/resources/fonts/simsun.ttc

第二步:将所有字体的值替换为该字体。创建一个脚本文件font.reg。

REGEDIT4

[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\FontLink\SystemLink]
"Lucida Sans Unicode"="simsun.ttc"
"Microsoft Sans Serif"="simsun.ttc"
"Tahoma"="simsun.ttc"
"Tahoma Bold"="simsun.ttc"
"SimSun"="simsun.ttc"
"Arial"="simsun.ttc"
"Arial Black"="simsun.ttc"

运行
wine regedit font.reg
 

重启即可

linux

Debian10/9 安装 Wine 5

 网上搜了一堆都是 4 的安装教程 5 安装都会失败.会提示下面错误

The following packages have unmet dependencies:
winehq-stable : Depends: wine-stable (= 5.0.1~buster)
E: Unable to correct problems, you have held broken packages.

下面是亲测可行的 wine5 的安装教程

#添加32位支持
sudo dpkg –add-architecture i386

#更新系统 安装依赖
sudo apt update
sudo apt -y install gnupg2 software-properties-common
wget -qO – https://dl.winehq.org/wine-builds/winehq.key | sudo apt-key add -
sudo apt-add-repository https://dl.winehq.org/wine-builds/debian/

Debian 10:

wget -O- -q https://download.opensuse.org/repositories/Emulators:/Wine:/Debian/Debian_10/Release.key | sudo apt-key add –
echo "deb http://download.opensuse.org/repositories/Emulators:/Wine:/Debian/Debian_10 ./" | sudo tee /etc/apt/sources.list.d/wine-obs.list

Debian 9:

wget -O- -q https://download.opensuse.org/repositories/Emulators:/Wine:/Debian/Debian_9.0/Release.key | sudo apt-key add –
echo "deb http://download.opensuse.org/repositories/Emulators:/Wine:/Debian/Debian_9.0 ./" | sudo tee /etc/apt/sources.list.d/wine-obs.list

#安装wine 稳定版本
sudo apt update
sudo apt install –install-recommends winehq-stable

//安装其他版本
sudo apt install –install-recommends winehq-devel
sudo apt install winehq-staging

查看版本
$ wine –version
wine-5.0

查看帮助
$ wine –help

运行例子:
$ cd ~/Downloads
$ wget https://notepad-plus-plus.org/repository/7.x/7.7/npp.7.7.Installer.exe
$ wine ./npp.7.7.Installer.exe

linux, 服务器相关

BuyVM 挂载 Block Storage(数据盘)

查看硬盘列表:
ls /dev/disk/by-id/
返回硬盘列表
ata-QEMU_DVD-ROM_QM00004 scsi-0BUYVM_SLAB_VOLUME-8888
格式化硬盘:
mkfs.ext4 -F /dev/disk/by-id/scsi-0BUYVM_SLAB_VOLUME-8888
挂载硬盘:
mount -o discard,defaults /dev/disk/by-id/scsi-0BUYVM_SLAB_VOLUME-8888 /home
开机自动挂载:
echo ‘/dev/disk/by-id/scsi-0BUYVM_SLAB_VOLUME-8888 /home ext4 defaults,nofail,discard 0 0′ | tee -a /etc/fstab
 
红色是Block Storage(数据盘)名称,  蓝色是挂载到的目录,我是挂载到了/home 你可以根据自己需求修改.

 

flutter

flutter 报错 Could not resolve io.flutter:flutter_embedding_release

 我是升级flutter后,所有项目都报错,先贴解决办法:

flutter\packages\flutter_tools\gradle 目录下

aar_init_script.gradle
resolve_dependencies.gradle
flutter.gradle
以上三个文件中将
http://download.flutter.io
替换为:

https://storage.googleapis.com/download.flutter.io

 

报错如下:

flutter build apk
The plugin `flutter_forbidshot` is built using an older version of the Android plugin API which assumes that it’s
running in a full-Flutter environment. It may have undefined behaviors when Flutter is integrated into an existing app
as a module.
The plugin can be updated to the v2 Android Plugin APIs by following https://flutter.dev/go/android-plugin-migration.
You are building a fat APK that includes binaries for android-arm, android-arm64, android-x64.
If you are deploying the app to the Play Store, it’s recommended to use app bundles or split the APK to reduce the APK
size.
To generate an app bundle, run:
flutter build appbundle –target-platform android-arm,android-arm64,android-x64
Learn more on: https://developer.android.com/guide/app-bundle
To split the APKs per ABI, run:
flutter build apk –target-platform android-arm,android-arm64,android-x64 –split-per-abi
Learn more on: https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split
[!] Your app isn’t using AndroidX.
To avoid potential build failures, you can quickly migrate your app by following the steps on https://goo.gl/CP92wY.

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ‘:flutter_tencentplayer:compileReleaseRenderscript’.
> Could not resolve all task dependencies for configuration ‘:flutter_tencentplayer:releaseCompileClasspath’.
> Could not resolve io.flutter:flutter_embedding_release:1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.
Required by:
project :flutter_tencentplayer
> Could not resolve io.flutter:flutter_embedding_release:1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.
> Could not get resource ‘http://download.flutter.io/io/flutter/flutter_embedding_release/1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c/flutter_embedding_release-1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.pom’.
> Could not GET ‘http://download.flutter.io/io/flutter/flutter_embedding_release/1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c/flutter_embedding_release-1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.pom’.
> download.flutter.io:80 failed to respond
> Could not resolve io.flutter:flutter_embedding_release:1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.
> Could not get resource ‘http://download.flutter.io/io/flutter/flutter_embedding_release/1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c/flutter_embedding_release-1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.pom’.
> Could not GET ‘http://download.flutter.io/io/flutter/flutter_embedding_release/1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c/flutter_embedding_release-1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.pom’.
> download.flutter.io:80 failed to respond
> Could not resolve io.flutter:flutter_embedding_release:1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.
> Could not get resource ‘http://download.flutter.io/io/flutter/flutter_embedding_release/1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c/flutter_embedding_release-1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.pom’.
> Could not GET ‘http://download.flutter.io/io/flutter/flutter_embedding_release/1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c/flutter_embedding_release-1.0.0-e1e6ced81d029258d449bdec2ba3cddca9c2ca0c.pom’.
> download.flutter.io:80 failed to respond

* Try:
Run with –stacktrace option to get the stack trace. Run with –info or –debug option to get more log output. Run with –scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 26s

python

flask Jinja2 template 模板 ' 编码问题

flask Jinja2 template 模板 &#39 编码问题

解决办法:

 {{ errors|safe }}
或者
{{ errors | tojson | safe }}

推荐第一条

python

Cython编译 TypeError: func() takes no keyword arguments 深坑

 今天使用Flask写了个接口,本地测试正常,仿到服务器上就报错,而且是特定函数报错.TypeError: func() takes no keyword arguments

一直以为是关键词冲突了. 后来调试半天,最后定位到是cython的问题

下面的方法无效

setup (
name = ‘xxxx’,
ext_modules = cythonize(["src/*.py"], compiler_directives={"always_allow_keywords": True})
)

最终解决办法,给函数的参数一个默认值即可.

# 原来
def func(a,b): pass
# 修改后
def func(a=None, b=None): pass

HTML & DIV+CSS, java script

layui 表格 时间戳转换 报错NaN-NaN-NaN NaN:NaN:NaN

 可能是时间戳 秒 和 毫秒之间 计算出现问题.

{{layui.util.toDateString(d.site_up_time)}}
修改成:
{{layui.util.toDateString(d.site_up_time*1000)}}

字段完整实例
,{field:’site_up_time’, title: ‘更新时间’, templet : "<div>{{layui.util.toDateString(d.site_up_time*1000)}}</div>"}