[code.nginx] Nginx各目录简介

Nginx目录内容

在安装完Nginx之后,可以到Nginx服务器安装后的目录里面查看资源列表。(下面举例说明的是mac上通过brew安装的Nginx目录)

Jorys-MBP:1.12.0 jory$ cd /usr/local/Cellar/nginx/1.12.0/
Jorys-MBP:1.12.0 jory$ ls *
CHANGES             README
INSTALL_RECEIPT.json        homebrew.mxcl.nginx.plist
LICENSE

bin:
nginx

html:
50x.html    index.html

share:
man

Jorys-MBP:nginx jory$ cd /usr/local/etc/nginx/
Jorys-MBP:nginx jory$ ls *
fastcgi.conf        koi-win         scgi_params
fastcgi.conf.default    mime.types      scgi_params.default
fastcgi_params      mime.types.default  uwsgi_params
fastcgi_params.default  nginx.conf      uwsgi_params.default
koi-utf         nginx.conf.default  win-utf

conf.d:
php-fpm

servers:

sites-available:

sites-enabled:
blog    default

ssl:
Jorys-MBP:logs jory$ cd /usr/local/var/logs/
Jorys-MBP:logs jory$ ls *
access.log

nginx:
error.log

Nginx服务器的安装目录中主要包括了conf、html、logs和sbin等4个目录。

1.conf目录

conf目录中存放了Nginx的所有配置文件。mac下使用brew安装的Nginx配置文件目录为/usr/local/etc/nginx。其中,nginx.conf文件是Nginx服务器的主配置文件,其他配置文件是用来配置Nginx的相关功能的,比如,配置fastcgi使用的fastcgi.conf和fastcgi_params两个文件。在此目录下,所有的配置文件都提供了以.default结尾的默认配置文件,方便我们将配置过的.conf文件恢复到初始状态。

2.html目录

html目录中存放了Nginx服务器在运行过程中调用的一些html网页文件。

  • index.html文件。index.html是在浏览器页面上打印出“Welcome to nginx!”这样一句话。此文件是Nginx服务器运行成功后,默认调用的网页。
  • 50x.html实在浏览器页面上打印出“The page you are looking for is temporarily unavailable.Please try again later.”Nginx在出现错误时会调用这个页面。
    另外可以在html目录上自定义一些网页文件,并在配置文件中配置发生什么情况时转到相应的文件。

3.logs目录

logs目录用来存放Nginx服务器的日志。Nginx的日志功能强大,有不同的种类,可以自定义输出格式内容。

4.sbin目录

存放Nginx服务器的主程序。在brew安装的nginx服务器中是bin目录。

你可能感兴趣的:([code.nginx] Nginx各目录简介)