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

Nginx Ubuntu vs CentOS 常见对照表

功能 Ubuntu/Debian 系列 CentOS/RHEL 系列
安装命令 sudo apt update && sudo apt install nginx -y sudo yum install nginx -ysudo 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/
相关推荐
tangyal1 分钟前
渗透笔记1
笔记·网络安全·渗透
qq_5895681018 分钟前
centos6.8镜像源yum install不成功,无法通过镜像源下载的解决方式
linux·运维·centos
weixin_516023071 小时前
linux下fcitx5拼音的安装
linux·运维·服务器
fanged1 小时前
STM32(5)--HAL1(TODO)
笔记
Master_oid1 小时前
机器学习29:增强式学习(Deep Reinforcement Learning)④
人工智能·学习·机器学习
hunter14501 小时前
Linux 进程与计划任务
linux·运维·服务器
楼田莉子2 小时前
Linux学习之磁盘与Ext系列文件
linux·运维·服务器·c语言·学习
一条闲鱼_mytube2 小时前
智能体设计模式(三)多智能体协作-记忆管理-学习与适应
人工智能·学习·设计模式
陌上花开缓缓归以2 小时前
linux 怎么模拟系统panic重启
linux·运维·服务器
月白风清江有声2 小时前
vscode使用git
linux·运维·服务器