科探空谷
  • Home
  • zhimind home
  • Categories
  • Tags
  • Archives
  • 留学
    • 学校库
    • 专业库
    • 研究方向与招生
    • 工具
    • GPA计算器
    • 脑洞背单词
    • 脱口而出

CentOS配置-Nginx安装

目录

  • 下载安装
    • 配置源
  • 配置
    • 默认文件nginx.conf
    • 简单配置
  • 运行
目录

下载安装¶

配置源¶

vi /etc/yum.repos.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/OS/OSRELEASE/$basearch/
gpgcheck=0
enabled=1

OS变更为相应的操作系统如 centos, OSRELEASE为6或7, 可以直接打开 http://nginx.org/packages 查看

yum -y install nginx

配置¶

默认文件nginx.conf¶

/etc/nginx/nginx.conf
和
/etc/nginx/conf.d/default.conf      // nginx.conf里有 include /etc/nginx/conf.d/*.conf 来导入

同理可以添加其他文件夹和文件,再在 nginx.conf 里 include, 其他一些发行版的 site-available, site-enabled 就是这个意思, 只要在新文件里写 server {} 部分即可

简单配置¶

http80\https443简单配置

运行¶

service nginx start
reload              // 重新加载配置文件
quit                // 正常关闭
stop                // 强制关闭

Published

8月 28, 2017

Category

数据库

Tags

  • Linux 8
  • Nginx 2
  • web 11

Stay in Touch

  • Powered by Pelican. Theme: Elegant by Talha Mansoor