Nginx是俄罗斯人编写的十分轻量级的HTTP服务器,Nginx,它的发音为“engine X”,是一个高性能的HTTP和反向代理服务器,同时也是一个IMAP/POP3/SMTP 代理服务器。
安装步骤
- 添加Nginx的yum源
rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
- 安装Nginx
yum install -y nginx
- 启动Nginx
systemctl start nginx.service
通过IP来访问你的Web页面来预览一下Nginx的默认页面;
- CentOS 7 开机启动Nginx
systemctl enable nginx.service
- 开放80端口
##Add firewall-cmd --permanent --zone=public --add-port=80/tcp ##Reload firewall-cmd --reload
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常用命令
# 查看版本 nginx -v # 查看nginx安装目录: ps -ef | grep nginx #检查配置文件: nginx -t # 启动: systemctl start nginx.service # 停止: systemctl stop nginx.service # 重启: systemctl restart nginx.service # 设置开机自启动: systemctl enable nginx.service #停止开机自启动: systemctl disable nginx.service # 查看当前状态: systemctl status nginx.service # 查看所有已启动的服务: systemctl list-units --type=service
Pingback: Nightingale安装 - 潍鲸笔记