yum安装Nginx

前端之家收集整理的这篇文章主要介绍了yum安装Nginx前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

配置源码

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

yum安装

sudo yum install -y Nginx

启动或停止

启动
sudo systemctl start Nginx  
停止  
sudo systemctl stop Nginx

查看状态

sudo systemctl status Nginx


或者你可以通过你的域名或IP来访问你的Web页面来预览一下Nginx的默认页面

开机启动

sudo systemctl enable Nginx

开放80端口

##Add
firewall-cmd --permanent --zone=public --add-port=80/tcp
##Reload
firewall-cmd --reload

卸载

sudo yum remove Nginx

配置信息说明

网站文件存放默认目录

/usr/share/Nginx/html

网站默认站点配置

/etc/Nginx/conf.d/default.conf

自定义Nginx站点配置文件存放目录

/etc/Nginx/conf.d/

Nginx全局配置

/etc/Nginx/Nginx.conf

Nginx启动

Nginx -c Nginx.conf

猜你在找的Linux相关文章