Nginx Ubuntu vs CentOS 常用命令对照表---详解笔记

Nginx Ubuntu vs CentOS 常见对照表

功能 Ubuntu/Debian 系列 CentOS/RHEL 系列
安装命令 sudo apt update && sudo apt install nginx -y sudo yum install nginx -y 或 sudo dnf install nginx -y
启动服务 sudo systemctl start nginx sudo systemctl start nginx
停止服务 sudo systemctl stop nginx sudo systemctl stop nginx
重启服务 sudo systemctl restart nginx sudo systemctl restart nginx
查看状态 sudo systemctl status nginx sudo systemctl status nginx
开机自启 sudo systemctl enable nginx sudo systemctl enable nginx
主配置文件 /etc/nginx/nginx.conf /etc/nginx/nginx.conf
虚拟主机配置目录 /etc/nginx/sites-available/ + /etc/nginx/sites-enabled/(通过软链接启用) /etc/nginx/conf.d/(直接放 .conf 文件)
默认网页目录 /var/www/html/ /usr/share/nginx/html/
测试配置是否正确 sudo nginx -t sudo nginx -t
防火墙放行 HTTP/HTTPS sudo ufw allow 'Nginx Full' sudo firewall-cmd --add-service=http --permanent && sudo firewall-cmd --reload
日志文件路径 访问日志:/var/log/nginx/access.log 错误日志:/var/log/nginx/error.log 访问日志:/var/log/nginx/access.log 错误日志:/var/log/nginx/error.log

重点记住三点差异:

  1. 安装命令 (apt vs yum/dnf)
  2. 站点配置目录 (Ubuntu 用 sites-available/ + sites-enabled/,CentOS 用 conf.d/)
  3. 网页目录 (Ubuntu 在 /var/www/html/,CentOS 在 /usr/share/nginx/html/)
相关推荐
众壹新能源科技7 小时前
逆变器自带无功不够用,加装5MVar SVG后功率因数从0.85回到0.99
运维·人工智能·自动化
..Dauntless..7 小时前
【Linux】一切皆文件和缓冲区
linux·运维·服务器
QMCY_jason7 小时前
x86 ubuntu2204 无gui 安装 openeuler 2203 aarch64版本
linux·运维·服务器
重生之小比特7 小时前
【Linux系统】12 进程程序替换 自定义Shell 命令行解释器
linux·运维·服务器
考拉讲支付7 小时前
母婴亲子服务平台分账架构设计:多场景多方分账与合规清结算实践
大数据·运维·人工智能·微信小程序·架构·微信公众平台
~patience~7 小时前
WAV 逆向分析工具使用笔记
笔记
滴啦嘟啦哒7 小时前
【具身笔记】【π0.5 微调与仿真】五、在MuJoCo中实现可视化仿真
笔记·python·vla·具身
xier_ran7 小时前
【infra之路】AI 编译器学习笔记(十三):AI 编译器全景——TVM、XLA、IREE 与其他
人工智能·笔记·学习
连山齐名7 小时前
ai应用开发的学习笔记
服务器·笔记·学习
LateFrames7 小时前
“场控软件” 如何容错与运维
运维·容错·led大屏·播控系统·场控软件