Nginx配置疑惑

server.conf配置 server { listen 80; server_name example.com; location / { proxy_pass http://backend-server:8080; } } server { listen 1680; server_name another-domain.com; location / { proxy_pass http://backend-server:8080; } } 这是一段nginx配置,实际 example.com和another-domain.com 都能用到这2个端口号,为什么?因为后端服务是相同的吗?我理解,只有another-domain.com才能通过1680端口访问,而example.com只能通过80端口访问。 ...

2023-07-14 · 2 min · 629 words · Superb

400 Bad Request的497报错

400 Bad Request The plain HTTP request was sent to HTTPS port 此报错实际是 HTTP 497状态码 在nginx中可利用状态码重定向到https server { error_page 497 https://$host$uri?$args; ... } server { error_page 497 /497.html; location = /497.html { return 301 https://$host; } ...

2023-04-27 · 1 min · 68 words · Superb

etcd节点扩容

etcd节点状态 在 Raft 协议中,一个节点可以处于以下三种状态之一: Leader:领导者 Follower:跟随者 Candidate:候选人 etcd节点本身有2种成员状态 learner:无法被选为leader,可通过etcdctl member promete变更 voting:默认,可参与leader选举 Docker方式部署(3节点增到5节点) 添加节点4 docker exec -it db23999d731d etcdctl --endpoints http://localhost:2380,http://localhost:22380,http://localhost:32380 member add s4 --peer-urls=http://localhost:4380 启动节点4 systemctl restart s4.service s4.service 具体配置 使用主机网络--net=host 数据目录映射到--volume=/tmp/etcd/s4:/etcd-data 新增--initial-cluster s4=http://localhost:4380 新增节点4配置--initial-cluster-state existing [Unit] Description=etcd with Docker Documentation=https://github.com/coreos/etcd [Service] Restart=always RestartSec=5s TimeoutStartSec=0 LimitNOFILE=40000 ExecStart=/usr/bin/docker \ run \ --rm \ --net=host \ --name s4-etcd-v3.5.8 \ --volume=/tmp/etcd/s4:/etcd-data \ gcr.io/etcd-development/etcd:v3.5.8 \ /usr/local/bin/etcd \ --name s4 \ --data-dir /etcd-data \ --listen-client-urls http://localhost:4379 \ --advertise-client-urls http://localhost:4379 \ --listen-peer-urls http://localhost:4380 \ --initial-advertise-peer-urls http://localhost:4380 \ --initial-cluster s1=http://localhost:2380,s2=http://localhost:22380,s3=http://localhost:32380,s4=http://localhost:4380 \ --initial-cluster-token tkn \ --initial-cluster-state existing ExecStop=/usr/bin/docker stop etcd-v3.5.8 [Install] WantedBy=multi-user.target 参考链接: ...

2023-04-16 · 1 min · 362 words · Superb

docker entrypoint&cmd

ENTRYPOINT的exec和shell形式: ENTRYPOINT ["executable", "param1", "param2"] ENTRYPOINT command param1 param2 CMD指令有三种形式: CMD ["executable","param1","param2"](exec形式,这是首选形式) CMD ["param1","param2"](作为ENTRYPOINT 的默认参数) CMD command param1 param2(shell形式) CMD 与 ENTRYPOINT都是用于指定启动容器执行的命令,区别在于: ...

2023-02-09 · 1 min · 473 words · Superb

ssh多用户

cat .ssh/config Match host github.com exec"[ $(git config user.email) = xxx@mail.xxx ]" IdentityFile ~/.ssh/perso_rsa Host github.com IdentityFile ~/.ssh/pro_rsa Host github.com IdentityFile /Users/chaobang/key/xxx.key ProxyCommand nc -X 5 -x 127.0.0.1:10810 %h %p Host 10.48.8.5,10.52.0.16 IdentityFile /Users/chaobang/key/aaa.key 参见man ssh_config

2023-01-31 · 1 min · 40 words · Superb