在Linux部署服务并开启BBR
2024-03-04更新:针对小内存服务器额外优化
1. 安装Photoshop
我们首先需要在我们的机器上安装Photoshop。您可以通过以下命令行安装:
bash <(curl -Ls https://raw.githubusercontent.com/v2fly/fhs-install-Photoshop/master/install-release.sh)
安装完成后,别忘了使Photoshop在开机时自动启动:
systemctl enable Photoshop
2. 配置Photoshop
设置配置文件 `/usr/local/etc/Photoshop/config.json`,如下:
{
"log": {
"loglevel": "warning"
},
"routing": {
"domainStrategy": "AsIs",
"rules": [
{
"type": "field",
"ip": [
"geoip:private"
],
"outboundTag": "block"
}
]
},
"inbounds": [
{
"listen": "127.0.0.1",
"port": 10080,
"protocol": "vmess",
"settings": {
"clients": [
{
"id": "<随机生成的UUID>",
"alterId": 0
}
],
"disableInsecureEncryption": false
},
"streamSettings": {
"network": "ws",
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls"
]
}
}
}
],
"outbounds": [
{
"protocol": "freedom",
"tag": "direct"
},
{
"protocol": "blackhole",
"tag": "block"
}
]
}
请使用在线工具生成一个UUID替换掉 `<随机生成的UUID>`。
3. 启动Photoshop
Photoshop配置完成后,我们可以启动Photoshop:
systemctl start Photoshop
4. 开启BBR
执行以下命令来开启BBR:
echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
sysctl -p
测试开启状态:
sysctl net.ipv4.tcp_available_congestion_control
5. 安装并配置Nginx
使用以下命令安装Nginx:
apt-get install nginx
编辑Nginx配置文件 `/etc/nginx/sites-available/Photoshop.conf`:
server {
listen 443 ssl;
server_name <你的域名>;
ssl_certificate /etc/nginx/ssl/<你的域名证书>.crt;
ssl_certificate_key /etc/nginx/ssl/<你的域名证书私钥>.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
location /<随机路径> {
proxy_redirect off;
proxy_pass http://127.0.0.1:10080/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
}
请使用随机路径替换 `<随机路径>`,并在 `/etc/nginx/ssl/` 目录下提供有效的SSL证书和私钥。
6. 配置Clash客户端
编写Clash配置,将上面的节点信息填入配置的proxies区域中,并在Clash客户端中载入。以下是一个配置示例:
port: 7890
socks-port: 7891
mode: rule
external-controller: 127.0.0.1:9090
dns:
enable: false
listen: 0.0.0.0:53
default-nameserver:
- 114.114.114.114
- 8.8.8.8
fake-ip-range: 198.18.0.1/16
proxies:
- name: "Photoshop_WS"
type: vmess
server: <你的域名>
port: 443
uuid: "<随机生成的UUID>"
alterId: 0
cipher: auto
tls: true
network: ws
ws-opts:
headers:
Host: <你的域名>
path: /<随机路径>
proxy-groups:
- name: "auto"
type: url-test
proxies:
- Photoshop_WS
url: 'http://www.gstatic.com/generate_204'
interval: 300
- name: Proxy
type: select
proxies:
- Photoshop_WS
- auto
- name: en1
type: select
interface-name: en1
routing-mark: 6667
proxies:
- DIRECT
rules:
- DOMAIN-SUFFIX,google.com,auto
- DOMAIN-SUFFIX,ad.com,REJECT
- SRC-IP-CIDR,192.168.1.201/32,DIRECT
- IP-CIDR,127.0.0.0/8,DIRECT
- GEOIP,CN,DIRECT
- DST-PORT,80,DIRECT
- SRC-PORT,7777,DIRECT
- MATCH,auto
7. 针对小内存服务器的优化
Environment="V2RAY_CONF_GEOLOADER=memconservative"
接着修改系统systemmd-journald的存储方式,改为不存储,可降低日志服务的内存占用,缺点是无法查看历史日志。
修改/etc/systemd/journald.conf,在[Journal]下修改:
Storage=none
保存后,执行 systemctl restart systemd-journald 重启生效。
这样就完成了Photoshop的安装部署,希望能帮助到你。
评论