春有百花秋有月
夏有凉风冬有雪在签发acme证书时报错Challenge error
<!--more-->
your_domain:Challenge error: <html>
<head><title>502 Bad Gateway</title></head>
<body>
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx</center>
</body>
</html>
[Mon Dec 18 10:34:38 AM CST 2023] Please add '--debug' or '--log' to check more details.
[Mon Dec 18 10:34:38 AM CST 2023] See: https://github.com/acmesh-official/acme.sh/wiki/How-to-debug-acme.sh
在签发证书前执行:
/root/.acme.sh/acme.sh --set-default -ca --server letsencrypt
再执行:
阅读剩余部分 →MBA调整Launchpad每列每行的数量方法
MacBook调整Launchpad 启动台的每一行、和每一列图标的数量,达到调整Launchpad图标大小的目的。
defaults write com.apple.dock springboard-columns -int 12
defaults write com.apple.dock springboard-rows -int 8
defaults write com.apple.dock ResetLaunchPad -bool TRUE
killall Dock
以上每行的含义:
1、调整每一列显示图标数量,9表示每一列显示9个,数字部分可根据个人喜好进行设置。
2、调整多少行显示图标数量,这里我用的是6,数字部分你也可以改成8或其他
3、重置Launchpad
4、重启Dock
JAVA&PYTHON
下面是Java和Python之间一些常见方面的区别总结成表格:
码块 |
| 变量定义 | 需要显式指定变量类型 | 不需要显式指定变量类型,使用动态类型 |
| 方法函数 | 方法必须定义在类中,使用关键字 public、private 等修饰符 | 函数可以独立定义,不需要包含在类中,使用关键字 def |
| 类 | 所有代码必须在类中,类是Java程序的基本构建块 | 可以有类,也可以没有类,定义类是可选的 |
| 继承 | 支持单继承,类只能继承一个父类 | 支持单继承和多继承,类可以继承多个父类 |
| 异常处理 | 使用 try-catch-finally 块来捕获和处理异常 | 使用 try-except-finally 块来捕获和处理异常 |
| 包管理 | 使用 Maven、Gradle 等工具管理依赖和构建 | 使用 pip 工具管理依赖和构建 |
| 迭代器 | 使用 for-each 循环遍历集合 | 使用 for-in 循环遍历集合 |
| 面向对象 | 面向对象语言,强调类和对象的概念 | 面向对象语言,但也可以以函数式编程方式使用 |
| 并发 | 支持多线程和并发编程 | 提供多种并发编程方式,包括多线程、协程和异步编程等 |
东北vs北京
东北是家,从05年上大学开始至今18载,累计驻留不足两年。北京不是家,却足足占据我这18载年华的大半时光。
或许,这世界上有两个我,一个在文字里,灵魂在东北,白马春衫慢慢行,另一个我,肉体在北京,蝇营狗苟的都市高楼中意难平。
细细想来,留住我肉体的,其实不是北京,是生活。灵魂向往的也不是东北,却也是生活。

v2ray 一键安装脚本
参考:https://github.com/233boy/v2ray
bash <(wget -qO- -o- https://git.io/v2ray.sh)

linux-debian init
sudo su
passwd root
useradd appadmin
passwd appadmin
打开SSH配置文件/etc/ssh/sshd_config,使用root权限进行编辑:
vim /etc/ssh/sshd_config
PermitRootLogin no //允许root登录
PasswordAuthentication yes //设置是否使用口令验证
service sshd reload
**
*
apt install sudo -y
添加你的本地用户到 sudo 组,可以使用 usermod 命令,如下:
usermod -aG sudo linux265
校正日期和时间:
-- 时区列表
timedatectl list-timezones
-- 修改系统时区为亚洲/上海
sudo timedatectl set-timezone Asia/Shanghai
-- 查看
timedatectl
进行系统更新:
sudo apt update
sudo apt upgrade -y
完成后安装常用软件:
阅读剩余部分 →Debian install typecho
tar -zvcf typecho.tar.gz
wget https://github.com/typecho/typecho/releases/download/ci/typecho.zip
2.解压
unzip typecho.zip
tar -zxvf typecho.tar.gz
3.为了防止权限出现问题, 修改全部文件的权限
chmod 777 -R /var/www/typecho
4.安装PHP及扩展
sudo apt-get -y install php8.2-sqlite3 php8.2-fpm p
<!--more-->
hp-mbstring php8.2-gd
5.启动php7.4-fpm, 默认监听9200端口
sudo systemctl start php8.2-fpm
service php8.2-fpm start
6.检查 PHP-FPM 配置:
打开 PHP-FPM 的配置文件,通常位于 /etc/php/8.2/fpm/pool.d/www.conf 中
确保 listen 配置项与 Nginx 的配置匹配。
/run/php/php8.2-fpm.sock
确保 listen.owner 和 listen.group 配置项与 Nginx 运行的用户和用户组匹配。
打开 Nginx 的虚拟主机配置文件,检查 fastcgi_pass 配置项。
fastcgi_pass unix:/var/run/php-fpm/www.sock;
确保此路径与 PHP-FPM 配置中的 listen 配置项一致。
阅读剩余部分 →Debian install acme
curl https://get.acme.sh | sh
2.生成证书:
/root/.acme.sh/acme.sh --issue --standalone -d passwd.313390.xyz
yum install socat
/root/.acme.sh/acme.sh --issue --standalone -d passwd.313390.xyz
systemctl stop nginx
/root/.acme.sh/acme.sh --issue --standalone -d passwd.313390.xyz
/root/.acme.sh/acme.sh --register-account -m bj.guozhong@gmail.com
/root/.acme.sh/acme.sh --issue --standalone -d passwd.313390.xyz --force
3.以下说明证书生成成功:
[Thu Jun 1 15:23:17 CST 2023] Your cert is in: /root/.acme.sh/passwd.20081014.xyz_ecc/passwd.20081014.xyz.cer
[Thu Jun 1 15:23:17 CST 2023] Your cert key is in: /root/.acme.sh/passwd.20081014.xyz_ecc/passwd.20081014.xyz.key
[Thu Jun 1 15:23:17 CST 2023] The intermediate CA cert is in: /root/.acme.sh/passwd.20081014.xyz_ecc/ca.cer
[Thu Jun 1 15:23:17 CST 2023] And the full chain certs is there: /root/.acme.sh/passwd.20081014.xyz_ecc/fullchain.cer
[Mon Jun 5 17:06:49 CST 2023] Your cert is in: /root/.acme.sh/www.313390.xyz_ecc/www.313390.xyz.cer
[Mon Jun 5 17:06:49 CST 2023] Your cert key is in: /root/.acme.sh/www.313390.xyz_ecc/www.313390.xyz.key
[Mon Jun 5 17:06:49 CST 2023] The intermediate CA cert is in: /root/.acme.sh/www.313390.xyz_ecc/ca.cer
[Mon Jun 5 17:06:49 CST 2023] And the full chain certs is there: /root/.acme.sh/www.313390.xyz_ecc/fullchain.cer
4.将生成的证书文件配置在nginx中:conf.d/20081014.xyz.conf
[root@ip-172-26-2-136 conf.d]# vi 20081014.xyz.conf
阅读剩余部分 →Debian Install fail2ban
Error:
Problem: problem with installed package selinux-policy-targeted-3.14.3-80.el8_5.2.noarch
- package fail2ban-server-1.0.2-3.el8.noarch requires (fail2ban-selinux if selinux-policy-targeted), but none of the providers can be installed
- package fail2ban-1.0.2-3.el8.noarch requires fail2ban-server = 1.0.2-3.el8, but none of the providers can be installed
- conflicting requests
- nothing provides selinux-policy >= 3.14.3-108.e
<!--more-->
l8_7.1 needed by fail2ban-selinux-1.0.2-3.el8.noarch
- nothing provides selinux-policy-base >= 3.14.3-108.el8_7.1 needed by fail2ban-selinux-1.0.2-3.el8.noarch
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)
解决方式:
yum install --allowerasing fail2ban
apt-get install fail2ban
安装成功后增加规则文件:/etc/fail2ban/filter.d/shadowsocks-libev.conf
配置jail.local文件:
[DEFAULT]
backend = systemd
bantime = 36000
findtime = 600
banaction = iptables-multiport
destemail = bj.guozhong@gmail.com
[sshd]
enabled = true
port = 22
filter = sshd
logpath = /var/log/auth.log
maxretry = 5
[shadowsocks-libev]
enabled = true
port = 3381
filter = shadowsocks-libev
logpath = /var/log/auth.log
maxretry = 3
bantime = 36000
findtime = 3600
systemctl start fail2ban
systemctl status fail2ban
systemctl enable fail2ban
查看日志和监狱内容
tail -f /var/log/fail2ban.log
fail2ban-client status
查看某个规则下的baned状态:
fail2ban-client status sshd
解除限制:fail2ban-client set sshd unbanip ****
有可能产生的问题:
1.新主机安装fail2ban无法启动,提示:
阅读剩余部分 →