交互方式
交互方式
systemctl edit nginx.service # 生成 drop-in 并自动 daemon-reload
systemctl edit --full nginx.service # 整份覆盖:升级后易脱节,不推荐长期使用手工方式
手工方式
mkdir -p /etc/systemd/system/nginx.service.d
cat > /etc/systemd/system/nginx.service.d/10-override.conf <<'EOF'
[Service]
LimitNOFILE=65535
EOF
systemctl daemon-reload && systemctl restart nginx确认合并结果
确认合并结果
systemctl cat nginx.service
systemctl show nginx -p LimitNOFILE片段按文件名排序合并,后加载覆盖先加载的同名键;用 10-、20- 数字前缀管理覆盖顺序。