nginx - 添加 apple-app-site-association 的 application/json

问题:苹果对 apple-app-site-association 的文件要求是不能添加后缀,如不能添加 .json 。nginx默认的设置,如果没有后缀的,当作 octet-stream,浏览器访问时,会弹出下载对话框,而不是直接显示内容。

尝试:可在nginx的站点配置文件里,添加相应的MIME类型,记得重新测试时先清除浏览器的缓存。

location = /.well-known/apple-app-site-association {
  default_type application/json;
}

参考:

magento - inventory_stock_1 doest exist - 导入数据库时需注意用户权限

现象:在原网站,以mysql的root用户,通过mysqldump导出magento2的数据库文件。将导出的数据库文件导入到cPanel空间的数据库。访问cPanel空间的站点,提示出错:

2 exception(s):
Exception #0 (Zend_Db_Statement_Exception): SQLSTATE[42S02]: Base table or view not found: 1146 Table 'aqtest.inventory_stock_1' doesn't exist, query was: SELECT COUNT(DISTINCT e.entity_id) FROM `catalog_product_entity` AS

尝试:编辑导出的magento2数据库文件,将原

DEFINER=`root`@`localhost`

替换为现数据库用户,如

DEFINER=`aqtest`@`localhost`

,最后重新导入。

参考:https://magento.stackexchange.com/questions/259534/inventory-stock-1-doest-exist-on-magento-2-3

cpanel - 用不同的版本的php命令 - /opt/cpanel/ea-php72/root/usr/bin/php - An exception was raised while creating "Request"

现象:在cPanel环境中执行magento2的命令,如 php bin/magento cache:flush提示出错:

An exception was raised while creating "Request"; no instance returned

尝试:用正确的php版本路径再次执行,如 /opt/cpanel/ea-php72/root/usr/bin/php bin/magento cache:flush

参考:

Shell交互输入日期和时间,查询web日志统计条数

##!/bin/sh

dates=$1
month=$(date | awk '{print $2}')
years=$(date | awk '{print $6}')
hours=$2
minutes=$3
seconds=$4


if [ "$seconds" = "" ] && [ "$minutes" = "" ] && [ "$hours" = "" ]; then
        grep "$dates/$month/$years" access.log | grep 'MOBILENO_QUERY'| wc -l;
elif [ "$seconds" = "" ] && [ "$minutes" = "" ]; then
        grep "$dates/$month/$years:$hours" access.log | grep 'MOBILENO_QUERY'| wc -l;
elif [ "$seconds" = "" ]; then
        grep "$dates/$month/$years:$hours:$minutes" access.log | grep 'MOBILENO_QUERY'| wc -l;
else
        grep "$dates/$month/$years:$hours:$minutes:$seconds" access.log | grep 'MOBILENO_QUERY'| wc -l;
fi 

shell-date-weblog.png

参考:

自动延活ssh会话 - ssh -o "ServerAliveInterval 60" - Connection reset by port 22

问题:有些服务器,设置了一段时间后(如3分钟后)ssh会话无活动时会自动断开,出现 Connection reset by anqun.org port 22 的提示信息,不方便长时间使用。

尝试:如在Windows的MobaXterm客户端中,可运行如 ssh -o "ServerAliveInterval 60" root@anqun.org 的命令,自动每60秒发送数据,延续ssh会话。

参考:https://superuser.com/questions/699676/how-to-prevent-ssh-from-disconnecting-if-its-been-idle-for-a-while