Skip to content

CentOS 8上安装Nginx

date: 2020-04-30 16:46:12 tags: [linux,nginx]

准备

确保有sudo权利

bash
$ sudo -l

查看80端口占用情况

bash
$ netstat -tulpn | grep :80

安装

安装nginx

bash
$ sudo yum install -y nginx

启动nginx服务器

bash
$ sudo systemctl enable nginx

启动nginx, 启动后就可以通过IP访问了

bash
$ sudo systemctl start nginx

查看启动状态

bash
$ sudo systemctl status nginx

常用命令

停止nginx

bash
$ sudo systemctl stop nginx

重新启动

bash
$ sudo systemctl start nginx

默认html文件位置

/usr/share/nginx/html

配置文件地址

/ect/nginx/nginx.conf

重新加载配置文件

bash
$ nginx -s reload

京ICP备2024093538号-1