Nginx主配置文件
类型 | 作用 | |
---|---|---|
/etc/nginx/nginx.conf | 配置文件 | nginx主配置文件 |
/etc/nginx/conf.d/default.conf | 配置文件 |
Nginx代理相关参数文件
类型 | 作用 | |
---|---|---|
/etc/nginx/fastcgi_params | 配置文件 | Fastcgi代理配置文件(php) |
/etc/nginx/scgi_params | 配置文件 | scgi代理配置文件 |
/etc/nginx/uwsgi_params | 配置文件 |
Nginx编码相关配置文件
类型 | 作用 | |
---|---|---|
/etc/nginx/win-utf | 配置文件 | Nginx编码转换映射文件 |
/etc/nginx/koi-utf | 配置文件 | Nginx编码转换映射文件 |
/etc/nginx/koi-win | 配置文件 | Nginx编码转换映射文件 |
/etc/nginx/mime.types | 配置文件 |
Nginx管理相关命令
类型 | 作用 | |
---|---|---|
/usr/sbin/nginx | 命令 | Nginx命令行管理终端工具 |
/usr/sbin/nginx-debug | 命令 |
Nginx日志相关目录与文件
路径 | 类型 | 作用 |
---|---|---|
/var/log/nginx | 目录 | Nginx默认存放日志目录 |
/etc/logrotate.d/nginx | 配置文件 | Nginx默认的日志切割 |
nginx主配置文件
1 2 3 |
Nginx主配置文件/etc/nginx/nginx.conf是一个纯文本类型的文件,整个配置文件是以区块的形式组织的。一般,每个区块以一对大括号{}来表示开始与结束。 Nginx主配置文件整体分为三块进行学习,分别是CoreModule(核心模块),EventModule(事件驱动模块),HttpCoreModule(http内核模块) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
[root@web02 ~]# cat /etc/nginx/nginx.conf #---------------------------核心模块------------------------------ #启动用户 user www; #工作进程数 worker_processes 1; #错误日志 debug/info/notice/warn/error/emeor error_log /var/log/nginx/error.log warn; #pid文件 pid /var/run/nginx.pid; #---------------------------事件驱动模块--------------------------- #事件 events { #工作进程的连接数 worker_connections 1024; } #------------------------------http内核模块------------------------ #网站配置 http { #nginx包含的文件类型 include /etc/nginx/mime.types; #当遇到nginx不识别的文件就会下载 default_type application/octet-stream; #日志格式 日志格式的名字 log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; #访问日志及调用格式 access_log /var/log/nginx/access.log main; #加快访问速度 sendfile on; #tcp_nopush on; #保持长连接 keepalive_timeout 65; #压缩 #gzip on; #包含的配置文件 include /etc/nginx/conf.d/*.conf; server { #服务监听端口 listen 80; #域名 server_name localhost; #字符集 charset koi8-r; #请求的地址 location / { #站点目录,当访问/的时候跳转目录 root /usr/share/nginx/html; #默认访问页面 index index.html index.htm; } } } |