net::ERR_INCOMPLETE_CHUNKED_ENCODING 500 错误,至少有一种可能是服务器磁盘满了。

net::ERR_INCOMPLETE_CHUNKED_ENCODING 500 错误,至少有一种可能是服务器磁盘满了。
虽然 Larave Auth 包含了验证邮箱以及密码的功能,但终归是固定样式的。想要更美观,更漂亮的验证功能,就得自定义。
自定义最直接的方法,就是重写发送逻辑。先贴出部分代码,然后读下边的文章,你肯定会做到的。
# App\Models\User;
//发送验证邮箱
// verification.verify 是你自定义的邮箱模板
public function sendEmailVerificationNotification()
{
\Illuminate\Auth\Notifications\VerifyEmail::toMailUsing(function ($notifiable) {
$url = \Illuminate\Support\Facades\URL::temporarySignedRoute(
'verification.verify', now()->addMinutes(60), ['id' => $notifiable->getKey()]);
$email = $this->email;
$nickname = $this->nickname;
$body = sprintf('<a href="%s" target="_blank">点击激活邮箱</a>', $url);
$mail = (new \Illuminate\Notifications\Messages\MailMessage)->view('emails.activateMail', ['nickname' => $nickname, 'url' => $url],
function (Message $message) use ($nickname, $email, $body) {
$message->subject('请激活你的邮箱');
$message->getSwiftMessage()->setBody($body);
$message->to($email, $nickname);
}
);
return $mail;
});
$this->notify(new \Illuminate\Auth\Notifications\VerifyEmail);
}
当然,你可以使用 trait 干净处理,还可以使用事件另外解耦,还可以添加队列进行异步处理。
做主从复制最重要的一点就是双方的server-id不能相同;然而在主服务器上只需要三步:
1. 是改server-id
2. 启用二进制日志
3. 创建有复制权限的帐号
vim /etc/my.conf
# 修改下边两项, 保存退出
log-bin=/alidata/service/mariadb/binlogs/master-bin
server-id = 1
:wq
# 创建目录
mkdir /alidata/service/mariadb/binlogs
# 设置用户组(先查看用户组)
grep mysql /etc/group
groups mysql
chown -R mysql.mysql /alidata/service/mariadb/binlogs
重启 mysql ,设置权限
# 重启 mysql
service mysqld restart
# 进入 mysql,设置权限,生效
mysql -u root -p
GRANT REPLICATION SLAVE,REPLICATION CLIENT ON *.* TO 'wangfang'@'xxx.xxx.xxx.105' IDENTIFIED BY '!Wfxxxxxxxxxx';
FLUSH PRIVILEGES;
再来配置从服务器配置。
编辑配置文件
vim /etc/my.conf
# 打开二进制文件 (从服务器可以不用打开)
# 二进制日志目录
log-bin=/tencent/service/mariadb/binlogs/master-bin
# 更改一个和主服务器不通的 id
server-id = 2
# 中继日志
relay-log =/tencent/service/mariadb/relaylogs/relay-bin
:wq 保存退出
创建文件夹,并设置用户组
mkdir /tencent/service/mariadb/binlogs/
mkdir /tencent/service/mariadb/relaylogs/
chown -R mysql.mysql /tencent/service/mariadb/binlogs/
chown -R mysql.mysql /tencent/service/mariadb/relaylogs/
# 重启
service mysqld restart
登入 mysql 查看中继日志是否启动中
mysql -u xxxx -p
# 查看中继日志是否启动
SHOW GLOBAL VARIABLES LIKE '%relay%';
# 出现 relay_log 项对应的文件就表示启动了。
配置从服务器连接主服务器相关
# 先在主服务器上查询
show master status;
+-------------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+-------------------+----------+--------------+------------------+
| master-bin.000001 | 93207 | | |
+-------------------+----------+--------------+------------------+
这儿只需要看 File 和 Position,其它的两个分别是白名单和黑名单,意思为同步哪几个数据库和不同步哪几个数据库,可自行根据需求进行设置。记录了前两个字段后,在从库上执行以下语句。
# 从服务器上执行
CHANGE MASTER TO MASTER_HOST='xxxxxxx',MASTER_USER='xxxxxxx',MASTER_PASSWORD='xxxxxxx',MASTER_LOG_FILE='master-bin.000001',MASTER_LOG_POS=93207;
但是此时的从服务器还没有工作起来,要使从服务器工作起来还要手动启动复制线程,我们上面的步骤写得很明白。
# 从数据库
START SLAVE;
从服务器还得自己建立数据库吗。
主服务器重启了,从服务器从新配置
主服务器操作
# 查看 File Position
show master status;
stop slave
# 再执行 CHANGE
# 再 start
start slave
https://www.cnblogs.com/xiaocen/p/3702945.html
https://www.cnblogs.com/gspsuccess/p/9182545.html?utm_source=debugrun&utm_medium=referral
An unexpected error occurred: “EPROTO: protocol error, symlink ‘../../../parser/bin/babel-parser.js’
yarn install 时报错
An unexpected error occurred: "EPROTO: protocol error, symlink '../../../parser/bin/babel-parser.js'
# 先删除 node_modules
rm -rf node_modules/
yarn install --save --no-bin-links
sh: 1: cross-env: not found
请删除 package.json
中的 cross-env
我们的视图有很多公共部分,比如导航菜单、底部信息、用户信息等,通常我们会以单独的视图组件来处理这些元素区块,但是如何从后端传递这些组件需要的数据变量是个问题,因为这些组件在多个页面中共用,从后端角度来看,会涉及到多个路由/控制器方法,难道我们要每次都重复获取并传递这些数据吗?有没有一种方式可以支持一处定义,多处复用?
那还用问,肯定有的叁,是不是脑海中闪现出了BaseController,嗯,是的,在没有接触laravel之前,通常我们处理上述问题的方法都是继承一个基控制器,把公共变量放在基类中实现,这样就能达到复用的目的,就像下面这样:
<?php
namespace App\Http\Controllers;
use App\Models\Config;
class BaseController extends Controller
{
private $cfg;
public function __construct()
{
$this->__init();
}
protected function __init()
{
$this->cfg = (object)Config::getAll();
}
}
条条大道通罗马,使用 linux 定时任务的方法也有很多种。都是 crontab,方式各不一样。列出常用,好用的一些命令。
# crontab文件一般位于/etc/下,这里面存放系统运行的的调度程序
more /etc/crontab
# 每个用户都会生成一个自动生成一个自己的crontab文件,一般位于/var/spool/cron目录下
cd /var/spool/cron
ls
# 查看当前用户或某个用户的定时任务,nginx 为用户
crontab -l nginx
# 编辑当前用户的定时任务
crontab -e
# 编辑某个用户的定时任务
crontab -e -u nginx
# 删除当前用户的定时任务
crontab -r
其实,laravel 使用定时任务不坑。坑的是一些细节问题。比如权限问题。如:root用户创建了定时任务,然后定时任务里边有了写日志的功能。这个时候,日志的用户组都是 root,然后其他用户组(nginx) 就没权限再写入数据了。这个时候,写入就会出错。这个就是坑。如果定时任务的用户是 nginx 就不会出现这个问题了。下边来下流程。
方式一
crontab -e -u nginx
# 然后在里边编写命令即可
方式二
# 创建命令文本(cron.txt)。再执行命令
# * * * * * nginx /alidata/service/php/bin/php /alidata/www/kwva/test.kwva.cn/artisan schedule:run >> /dev/null 2>&1
crontab cron.txt -u nginx
https://learnku.com/articles/6775/about-laravel-log-permissions
https://www.runoob.com/linux/linux-comm-crontab.html
通常情况下,使用构建的命令就可以关闭对应的服务。可有时候 pid 被删了后,程序逻辑就关闭不了服务了。这个时候,就得用命令来关。
laravel 中 swoole 为例
# 停止
php artisan swoole:action stop
# 启动
php artisan swoole:action start
当 pid 文件删除或被改后,就 stop 不了了。
# 先查看端口对应的进程 id
netstat -tunlp|grep 9400
### 结果 tcp 0 0 0.0.0.0:9400 0.0.0.0:* LISTEN 2750/php
# 再 kill 进程 id 就完事了
kill -9 2750
# 查看进程信息 (当然在 kill 之前查看)
ps -ef|grep 2750
想做一个类似腾讯云和58同城的个人认证功能,就是输入身份证号码,然后给微信支付一分钱,这个支付只能这个身份对应的微信支付,不然会提示“您的身份资料和账户资料不匹配,请核实后再发起支付”,有人做过类似的么?公开的微信支付api没看到能做这个设置,还是说这个是微信支付的内部api?问了微信支付的技术支持,没有确定的回复,只是说可能是没有开放的接口。
https://www.zhihu.com/question/270112298
https://blog.csdn.net/weixin_42389328/article/details/84587661
https://max.book118.com/html/2017/0803/125839734.shtm
http://kf.qq.com/faq/171219EfYVfI171219EbEfY7.html
区别对待呀。
方式一: yum 安装
yum install epel-release
yum install supervisor
systemctl enable supervisord # 开机自启动
systemctl start supervisord # 启动supervisord服务
systemctl status supervisord # 查看supervisord服务状态
ps -ef|grep supervisord # 查看是否存在supervisord进程
方式二: apt-get 安装
apt-get install supervisor
操作
systemctl stop supervisord
systemctl start supervisord
systemctl status supervisord
systemctl reload supervisord
systemctl restart supervisord
使用之前
cat /etc/supervisord.conf
在最底部,会看到:
files = supervisord.d/*.ini
这个会调用 supervisord.d 目录下的配置文件。所以我们的配置文件都建在 supervisord.d 下。
使用
vim mlxiu-queue.ini
[program:mlxiu]
process_name=%(program_name)s_%(process_num)02d
command=/alidata/service/php/bin/php /alidata/www/www.mlxiu.com/artisan queue:work redis --sleep=3 --tries=3
autostart=true
autorestart=true
user=nginx
numprocs=8
redirect_stderr=true
stdout_logfile=/alidata/logs/supervisord/www.yueqiubao.net.txt
stdout_logfile 文件一定要先创建好哈。
https://learnku.com/articles/28919
https://blog.csdn.net/donggege214/article/details/80264811
https://blog.csdn.net/kkevinyang/article/details/80539940?utm_source=blogxgwz3