cd /etc/systemd/system&&touch nginxReboot.service
将下面内容复制到/etc/systemd/system/nginxReboot.service
[Unit]
Description=nginx - high performance web server
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/run/nginx.pid
Environment=PATH=/root/.nvm/versions/node/v12.8.1/bin:/usr/bin/v2ray/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
ExecStartPre=/usr/sbin/nginx -t -c /etc/nginx/nginx.conf
ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf
ExecReload=/usr/sbin/nginx -s reload
ExecStop=/usr/sbin/nginx -s stop
ExecQuit=/usr/sbin/nginx -s quit
PrivateTmp=true
[Install]
WantedBy=multi-user.target
sudo systemctl enable nginxReboot.service
# 可能会出现 (13: Permission denied) while connecting to upstream:[nginx]
// 解决方法 执行下面的命令
setsebool -P httpd_can_network_connect 1
cd /etc/systemd/system&&touch v2ray_ws_tls.service
将下面内容复制到/etc/systemd/system/v2ray_ws_tls.service
[Unit]
Description=V2Ray WS TLS Service
After=network.target
Wants=network.target
[Service]
Type=simple
PIDFile=/run/v2rayWSTLS.pid
ExecStart=/usr/bin/v2ray/v2ray -config /root/config_ws_tls.json
Restart=on-failure
# Don't restart in the case of configuration error
RestartPreventExitStatus=23
[Install]
WantedBy=multi-user.target
sudo systemctl enable v2ray_ws_tls.service
# 执行下方命令查看v2ray是否启动
ps -ef|grep v2ray
root 4533 1 0 03:03 ? 00:00:00 /usr/bin/v2ray/v2ray -config /root/config_ws_tls.json
root 4560 1287 0 03:04 pts/0 00:00:00 grep --color=auto v2ray
# 执行下方命令查看nginx是否启动,
ps -ef|grep nginx
``
root 762 1 0 02:20 ? 00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
nginx 763 762 0 02:20 ? 00:00:00 nginx: worker process
root 4562 1287 0 03:04 pts/0 00:00:00 grep --color=auto nginx
2.开启Centos bbr拥塞控制算法[我的测试机是centos 7]
有一些vps会自带bbr模块 比如搬瓦工的某些机器,执行下面命令
如果输出类似内容则已经开启bbr 到这里就可以结束了
CentOS Linux release 7.7.1908 (Core)
rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
yum --enablerepo=elrepo-kernel install kernel-ml -y
Transaction Summary
================================================================================
Install 1 Package
Total download size: 39 M
Installed size: 169 M
Downloading packages:
kernel-ml-4.9.0-1.el7.elrepo.x86_64.rpm | 39 MB 00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
Installing : kernel-ml-4.9.0-1.el7.elrepo.x86_64 1/1
Verifying : kernel-ml-4.9.0-1.el7.elrepo.x86_64 1/1
Installed:
kernel-ml.x86_64 0:4.9.0-1.el7.elrepo
Complete!
依次执行下面的命令,重启后需要等待数秒重新使用ssh连接
egrep ^menuentry /etc/grub2.cfg | cut -f 2 -d \'
grub2-set-default 0
reboot
5.3.7-1.el7.elrepo.x86_64
net.core.default_qdisc = fq
net.ipv4.tcp_congestion_control = bbr
sysctl net.ipv4.tcp_available_congestion_control
net.ipv4.tcp_available_congestion_control = bbr cubic reno