XiaoFeng | 筱枫

Jinja2 UTF-8 garbled solution

Original link: https://hsiaofeng.com/archives/185.html original code with open(f”file.j2″,’w+’) as fout: content = template.render() fout.write(content) solution Change w+ at open() to wb , and call encode(‘utf-8′) after template.render() ). with open(f”file.j2″,’wb’) as fout: content = template.render().encode(‘utf-8’) fout.write(content) This article is reproduced from: https://hsiaofeng.com/archives/185.html This site is for inclusion only, and the copyright belongs to the original author.

Jinja2 UTF-8 garbled solution Read More »

Debian configuration tutorial collection

Original link: https://hsiaofeng.com/archives/184.html LNMP https://www.vultr.com/docs/how-to-install-nginx-mariadb–php-lemp-on-debian-11-99568 WWW Jump https://www.vultr.com/docs/nginx-redirects-for-non-www-sub-domains-to-www This article is reproduced from: https://hsiaofeng.com/archives/184.html This site is for inclusion only, and the copyright belongs to the original author.

Debian configuration tutorial collection Read More »

Error when adding user sudo in Debian system

Original link: https://hsiaofeng.com/archives/183.html mistake adduser: command not found solution Use su -l instead of su . $ su -l # adduser <your_username_here> sudo # logout refer to https://unix.stackexchange.com/questions/565665/bash-adduser-command-not-found-debian-buster This article is reproduced from: https://hsiaofeng.com/archives/183.html This site is for inclusion only, and the copyright belongs to the original author.

Error when adding user sudo in Debian system Read More »

Modify SSH port on Debian system

Original link: https://hsiaofeng.com/archives/182.html Edit the Port of the configuration file: vi /etc/ssh/sshd_config Release port: iptables -A INPUT -p tcp –dport 端口号-j ACCEPT Save and restart the SSH service: iptables-save > /etc/iptables.up.rules /etc/init.d/ssh restart refer to https://www.laozuo.org/14001.html This article is reproduced from: https://hsiaofeng.com/archives/182.html This site is for inclusion only, and the copyright belongs to the original

Modify SSH port on Debian system Read More »