Linux 服务器介绍和使用
常用 Linux 版本分析
常用工具/概念/使用方式
以前和现在的服务器(托管和云平台)
服务器配置
部署项目
在新装的Linux上连接老报错 unexpected extra_header
这个原因是因为 websockets 14 版本导致的错误,可以先尝试将 websocket 版本降低来避免这个问题
pip install websockets==10.4
nginx 的 403 Forbidden errors
nginx 的 403 Forbidden errors 表示你在请求一个资源文件但是nginx不允许你查看。
403 Forbidden 只是一个HTTP状态码,像404,200一样不是技术上的错误。
哪些场景需要返回403状态码的场景?
BBR加速
Debian / Ubuntu 14.04 +
CentOS用户请使用这个脚本:CentOS/Debian/Ubuntu系统 TCP-BBR 一键安装脚本
本脚本只在 Debian 7 / Debian 8 / Ubuntu 14.04 / Ubuntu 16.04 (均 x64位) 这几个系统中测试过脚本可以正常运行(Vultr)!
强烈推荐 Debian 7 x64,这个是我一直使用的系统,我的脚本在这个系统上面出错率最低。
至于为什么不支持 CentOS 等系统,主要是我不怎么用其他的系统,就不做支持了。
nginx配置静态网页
负载均衡
1 | upstream bbs { |
ubuntu20.04挂起后无法唤醒的问题
挂起后无法唤醒,一直黑屏。好像N卡普遍会有这个问题。为了这个破问题找了很多方法,网上很多说升级内核、升级显卡驱动还有些其它的方法都试过也没用,还把系统弄崩过。后来在外网找到一个不算完美的解决方法,就是把nvidia的挂起与休眠服务给停了。具体代码
sudo systemctl stop nvidia-suspend.service
sudo systemctl stop nvidia-hibernate.service
sudo systemctl stop nvidia-resume.services
udo systemctl disable nvidia-suspend.service
sudo systemctl disable nvidia-hibernate.service
sudo systemctl disable nvidia-resume.service
sudo rm /lib/systemd/system-sleep/nvidia
然后重启电脑。
git服务端强制覆盖本地
1 | git reset --hard origin/master |
github怎么绑定自己的域名?
- 向你的 Github Pages 仓库添加一个CNAME(一定要大写)文件其中只能包含一个顶级域名,
像这样:1
example.com
How to squash all commits on branch
Another way to squash all your commits is to reset the index to master:
1 | git checkout yourBranch |
This isn’t perfect as it implies you know from which branch “yourBranch” is coming from.
Note: finding that origin branch isn’t easy/possible with Git (the visual way is often the easiest, as seen here).
Note: git branch --show-current has been introduced with Git 2.22 (Q1 20219).
EDIT: you will need to use git push --force
Karlotcha Hoa adds in the comments: For the reset, you can do
1 | git reset $(git merge-base master $(git rev-parse --abbrev-ref HEAD)) |
[That] automatically uses the branch you are currently on.
And if you use that, you can also use an alias, as the command doesn’t rely on the branch name.
sschoof adds in the comments:
Since my default branch is called main and my search had multi times brought me here:
To copy it for my next time
1 | git reset $(git merge-base main $(git rev-parse --abbrev-ref HEAD)) |
git rebase记录
1 | git checkout dev |