分类 电脑 下的文章

手工设置dns记录,申请Let's Encrypt泛域名证书

系统:debian9。

过程:

1.curl https://get.acme.sh | sh # 先安装acme申请证书脚本

2.source ~/.bashrc # 重载配置文件,可直接使用acme.sh命令

3.acme.sh --issue -d liujing.ltd -d *.liujing.ltd --dns --yes-I-know-dns-manual-mode-enough-go-ahead-please # 手工添加dns记录来申请泛域名证书
acme-dns-domain-1.png

4.在域名解析面板里添加好相应的TXT记录
acme-dns-domain-2.png

5.需添加两条TXT记录
acme-dns-domain-3.png

6.acme.sh --renew -d liujing.ltd -d *.liujing.ltd --dns --yes-I-know-dns-manual-mode-enough-go-ahead-please # 申请证书
acme-dns-domain-4.png

7.将申请到证书文件fullchain.cer和liujing.ltd.key配置到web站点后,在火狐浏览器查看站点证书信息,正常
acme-dns-domain-5.png

参考:https://github.com/Neilpang/acme.sh/wiki/dns-manual-mode

在nginx为站点带参数的网址重定向到不同的新页面

问题:将php的站点静态化后,搜索引擎中的一些页面想跳转到新的静态页如,如 post.php?id=5 重定向到 post35ta.html,post.php?id=7 重定向到 postd26t.html。

处理:可在nginx的站点配置文件中,设置按条件301跳转,如:

location = /post.php {
    if ($arg_id = 5) {
        return 301 http://liujia.anqun.org/post35ta.html;
    }
    if ($arg_id = 7) {
        return 301 http://liujia.anqun.org/postd26t.html;
    }
                                                                                                                    
    try_files  $uri /index.html;
}

参考:

通过debian-installer远程dd安装Windows

系统:debian 9 64位。

过程:

1.apt install kexec-tools # 安装 kexec 热内核切换工具
debian-installer-remote-1.png

2.wget http://cdn-fastly.deb.debian.org/debian/dists/buster/main/installer-amd64/current/images/netboot/debian-installer/amd64/linux # 下载 debian10 的网络安装文件

3.wget http://cdn-fastly.deb.debian.org/debian/dists/buster/main/installer-amd64/current/images/netboot/debian-installer/amd64/initrd.gz # 下载 debian10 的网络安装文件

4.wget https://github.com/fincham/kexec-remote-debian-install/raw/master/build.py # 下载脚本,制作自动安装配置文件

5.vi build.py # 增加ntfs模块,ntfs-3g-udeb fuse-modules-4.19.0-11-amd64-di fuse-udeb,要留意fuse-modules的版本会跟着内核更新的
debian-installer-remote-2.png

6.chmod +x build.py # 增加执行权限

7../build.py initrd.gz enp0s20f0 144.172.126.32 255.255.255.0 144.172.126.1 8.8.8.8 # 假设网卡名是enp0s20f0(如有的网卡名是eno1),设置静态网络信息。如果是dhcp的,可用auto替换网卡具体名称
debian-installer-remote-3.png

8.kexec --command-line="auto=true priority=critical mirror/http/hostname=deb.debian.org" --initrd=initrd.gz linux # 热切换到网络安装的内核上
debian-installer-remote-4.png

9.ssh installer@144.172.126.32 # 等一小段时间后,可以通过ssh登录,继续安装

10.选择菜单 Start installer (expert mode)
debian-installer-remote-5.png

11.选择菜单, Detect disks # 识别硬盘
debian-installer-remote-6.png

12.选择菜单,Execute a shell # 切换到命令控制台
debian-installer-remote-7.png

13.Continue # 进到ash
debian-installer-remote-8.png

14.fdisk -l /dev/sda # 查看当前的分区信息,有多个Linux分区
debian-installer-remote-9.png

15.wget -O- http://url/w2k19-virtio-nic-unattend.vhd.gz | gunzip | dd of=/dev/sda # dd安装
debian-installer-remote-10.png

16.fdisk -l /dev/sda # 再次查看分区信息,dd后是仅有一个Windows分区
debian-installer-remote-12.png

17.mount.ntfs /dev/sda1 /mnt # 会提示错误,Invalid argument,可能是因为内核没有更新分区表。debian9的installer会这样,但debian10的是正确的,所以用debian10 installer的话,下边的分区步骤就不用做了
debian-installer-remote-13.png

18.新开一个ssh会话,选择菜单 Partition disks ,选择 Guided - use the largest continuous free space
debian-installer-remote-14.png

19.选择菜单 All files in one pration (recommended for new users)
debian-installer-remote-15.png

20.选择菜单 Finish partitioning and write changes to disk # 确认第一个Windows分区信息无误的话,更新分区信息
debian-installer-remote-16.png

21.再次确认分区更改
debian-installer-remote-17.png

22.mount.ntfs /dev/sda1 /mnt # 再次尝试挂载NTFS分区,成功

23.nano /mnt/Windows/panther/Unattend.xml # 编辑Windows无人值守安装文件,更改里边的IP设置
debian-installer-remote-20.png

24.umount /mnt # 卸载/mnt

25.reboot

26.Windows完成安装
debian-installer-remote-19.png

27.debian-installer还有日志文件,如遇到错误,可通过web查看
debian-installer-remote-11.png

参考:

手动关闭magento的维护模式

问题:访问站点,提示 “Service Temporarily Unavailable. The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later”

magento-maintenance-flag-1.png

处理:如果 magento 站点根目录有 maintenance.flag 的文件,重命名为其它或删除之。手动关闭维护模式。

magento-maintenance-flag-2.png

参考:https://magento.stackexchange.com/questions/71157/service-temporarily-unavailable-after-installing-a-module