CentOS 7 安装 nginx

概述

之前以为在CentOS上面安装配置 Nginx确定麻烦,因此一直没有动。今天试了一下发现还挺简单的,只须要几步就OK。nginx

安装 Nginx

Nginx 官网给出了详细的安装教程,安装Nginx 总结了一些 CentOS 上面的安装步骤:git

配置 yum 源:

  1. 须要在新建 /etc/yum.repos.d/nginx.repo 文件,
  2. 而且编辑文件内容为:
[nginx] name=nginx repo 
baseurl=http://nginx.org/packages/mainline/centos/7/$basearch/ 
gpgcheck=0 
enabled=1
  1. 安装 Nginx 只需执行命令:yum -y install nginx
  2. 启动 Nginx 下面总结了一些启动 Nginx 的命令:
systemctl start nginx.service //启动apache
systemctl stop nginx.service //中止apache
systemctl restart nginx.service //重启apache
systemctl enable nginx.service //设置apache开机启动

修改配置文件

若是有特殊要求能够修改 /etc/nginx/下面相应的配置文件github

Migrated to https://sheltonsuen.github.ioshell

相关文章
相关标签/搜索