menu

Debian 10

谷歌云

locale

报警告:

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = (unset),
	LANG = "en_US.utf8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

重新设置生成 locale

sudo apt install locales
sudo dpkg-reconfigure locales
sudo locale-gen en_US.UTF-8

nginx

sudo apt install nginx

http auth

sudo apt install apache2-utils
sudo mkdir /etc/apache2
sudo htpasswd -c /etc/apache2/.htpasswd user1

编辑 nginx.conf

location /api {
    auth_basic           “Administrator’s Area”;
    auth_basic_user_file /etc/apache2/.htpasswd;
}

bbr

未开启 bbr 生成一个 300Mb 的文件:

sudo dd if=/dev/urandom of=300Mb.txt bs=32MB count=10

开 10 个链接下载速度 685kb/s

2020/11/18 11:43:35 task.go:203: [32000000 32000000 32000000 32000000 32000000 32000000 32000000 32000000 32000000 32000000]
2020/11/18 11:43:35 task.go:235: download:map[Range:[bytes=0-32000000]]
2020/11/18 11:43:35 task.go:235: download:map[Range:[bytes=160000000-192000000]]
2020/11/18 11:43:35 task.go:235: download:map[Range:[bytes=224000000-256000000]]
2020/11/18 11:43:35 task.go:235: download:map[Range:[bytes=192000000-224000000]]
2020/11/18 11:43:35 task.go:235: download:map[Range:[bytes=64000000-96000000]]
2020/11/18 11:43:35 task.go:235: download:map[Range:[bytes=128000000-160000000]]
2020/11/18 11:43:35 task.go:235: download:map[Range:[bytes=256000000-288000000]]
2020/11/18 11:43:35 task.go:235: download:map[Range:[bytes=288000000-320000000]]
2020/11/18 11:43:35 task.go:235: download:map[Range:[bytes=32000000-64000000]]
300Mb.txt 17.37% 01:19    [##-------------###-------------###------------###-------------##--------------###------------###-------------###------------###-------------##--------------| 06:16 ] 685.68Kb/s

编辑 /etc/sysctl.conf 加入:

net.core.default_qdisc = fq
net.ipv4.tcp_congestion_control = bbr

重启 gcloud compute instances reset [INSTANCE_NAME] --zone=[ZONE] 可以看到 bbr 生效 lsmod | grep bbr

tcp_bbr                20480  11

net.ipv4.ip_forward = 1 net.ipv6.conf.all.forwarding = 1

trojan/trojan-go

sudo apt install trojan

trojan 会占用 443 端口,所以 nginx 不能使用 443 端口,trojan 会被 443 端口的 http 流量转发到 80 端口,所以 nginx 下的站也能用 https 访问。

trojan-go, https://p4gefau1t.github.io/trojan-go

apt 的 go 版本只有 1.11,安装 go 1.15+: https://www.digitalocean.com/community/tutorials/how-to-install-go-on-debian-10

编译 trojan-go

go build --tags "full"

systemd

keyboard_arrow_up