【笔记】Nginx 学习笔记
前言
Nginx学习笔记
安装Nginx
MacOS
1 | brew install nginx |
Debian
1 | apt install nginx |
CentOS
- 新建
.repo文件
1 | vim /etc/yum.repos.d/nginx.repo |
- 编辑
.repo文件
<OS>:系统,如centos<OSRELEASE>:系统版本,如7
1 | [nginx] |
- 安装
1 | yum install nginx |
修改配置文件
验证配置文件
1 | nginx -t |
验证指定配置文件
1 | nginx -t -c /etc/nginx/nginx.conf |
启动Nginx
1 | nginx |
指定配置启动
- 默认使用
/etc/nginx/nginx.conf配置文件启动nginx
1 | nginx -c /etc/nginx/nginx.conf |
重新加载配置文件
1 | nginx -s reload |
快速停止
1 | nginx -s stop |
正常停止
1 | nginx -s quit |
查看版本
1 | nginx -v |