2) 配置篇
2.1:nginx.conf 为主配置文件
2.1.1:nnginx.conf 文件是以{} 作区域分隔的纯文本配置文件
2.1.2?Nginx 配置文件目录结构
使用 tree 命令查看目录结构, 若提示 - bash:?tree: command not found? 则使用: yum install? -y tree
tree /usr/local/nginx/
总结配置文件分布规律: 以 *.default 结尾的为默认的备份文件? ? 带 temp 字样的为临时目录或文件
- nginx/
- |-- client_body_temp
- |-- conf? ? ? ?? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? #包含所有配置
- |? ? ?|-- fastcgi.conf? ? ? ? ? ? ? ? ? ? ?# 通用网关接口配置文件
- |? ? ?|-- fastcgi.conf.default? ? ?# 通用网关接口配置文件备份
- |? ? ?|-- fastcgi_params
- |? ? ?|-- fastcgi_params.default
- |? ? ?|-- koi-utf
- |? ? ?|-- koi-win
- |? ? ?|-- mime.types? ? ? ? ? ? ? ? ? ? #支持的媒体库类型
- |? ? ?|-- mime.types.default
- |? ? ?|-- nginx.conf? ? ? ? ? ? ? ? ? ? ? #nginx 服务主配置文件
- |? ? ?|-- nginx.conf.default
- |? ? ?|-- scgi_params
- |? ? ?|-- scgi_params.default
- |? ? ?|-- uwsgi_params
- |? ? ?|-- uwsgi_params.default
- |? ? ?`-- win-utf
- |----fastcgi_temp
- |-- html? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? #安装 Nginx 的默认站点目录
- |? ? |-- 50x.html
- |? ? ?-- index.html
- |? ? ---- logs? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??# 安装 Nginx 后默认的日志目录
- |? ? ? ? |-- access.log? ? ? ? ? ? ? ? ? ? ? ?# 访问日志
- |? ? ? ? |-- error.log? ? ? ? ? ? ? ? ? ? ? ? ? ? #错误日志
- | -- nginx.pid
- |-- proxy_temp
- |-- sbin? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? #可执行主程序文件夹
- |? ? ? ? ?-- nginx? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?#Nginx 主程序
- |-- scgi_temp
- -- uwsgi_temp
2.1.3:Nginx 功能模块
Nginx 之所以流行, 是因为它具有强大的模块功能常用的模块有:
Nginx 核心模块
为 Nginx 配置文件的全局应用
vim? /usr/local/nginx/conf/nginx.conf.default
接下来为标准 Http 功能模块
其中包含了基本常用的模块
- ngx_http_core_module? ?
- ngx_http_access_module? ?
- ngx_http_gzip_module
- ngx_http_ssl_module
- ngx_http_status_module? ? ?# 单独添加
- ngx_http_auth_basic_module
来源: http://www.bubuko.com/infodetail-2544912.html