CentOS安装Nginx

简介

Nginx (engine x) 是一个高性能的HTTP和反向代理web服务器,同时也提供了IMAP/POP3/SMTP服务。Nginx是由伊戈尔·赛索耶夫为俄罗斯访问量第二的Rambler.ru站点(俄文:Рамблер)开发的。

其将源代码以类BSD许可证的形式发布,因它的稳定性、丰富的功能集、简单的配置文件和低系统资源的消耗而闻名。

Nginx是一款轻量级的Web 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器,在BSD-like 协议下发行。其特点是占有内存少,并发能力强,事实上nginx的并发能力在同类型的网页服务器中表现较好。

安装

添加Nginx到YUM源

1
rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

安装Nginx

1
yum -y install nginx

启动Nginx

刚安装的Nginx不会自动启动

1
systemctl start nginx.service

查看Nginx状态

1
2

systemctl enable nginx.service

设置开机自启

1
systemctl status nginx.service

停止Nginx

1
systemctl stop nginx.service

重启Nginx

1
systemctl restart nginx.service

重新读取nginx配置

这个最常用, 不用停止nginx服务就能使修改的配置生效

1
systemctl reload nginx.service

网站文件存放默认目录

1
/usr/share/nginx/html

Nginx配置文件路径

1
/etc/nginx/nginx.conf

CentOS安装Nginx
https://www.songhaozhi.com/2022/09/23/CentOS安装Nginx/
Beitragsautor
宋浩志
Veröffentlicht am
September 23, 2022
Urheberrechtshinweis