仅为记录一些常用的centOS操作,不定时更新
nginx安装
1. CentOS8已在yum官方源中新增了nginx,直接安装
# yum install -y nginx
2. 启动nginx
# systemctl start nginx.service
3. 设置 nginx 开机自启动
# systemctl enable nginx.service
nginx 配置信息
网站文件存放默认位置(Welcome to nginx 页面)
/usr/share/nginx/html
网站默认站点配置
/etc/nginx/conf.d/default.conf
自定义 nginx 站点配置文件存放目录
/etc/nginx/conf.d/
nginx 全局配置文件
/etc/nginx/nginx.conf
nginx的服务 启动/停止/刷新配置文件/查看状态
# systemctl start nginx.service ##启动nginx服务
# systemctl stop nginx.service ##停止服务
# systemctl restart nginx.service ##重新启动服务
# systemctl list-units --type=service ##查看所有已启动的服务
# systemctl status nginx.service ##查看服务当前状态
# systemctl enable nginx.service ##设置开机自启动
# systemctl disable nginx.service ##停止开机自启动