博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
nginx默认的配置文件详解
阅读量:4606 次
发布时间:2019-06-09

本文共 3034 字,大约阅读时间需要 10 分钟。

# For more information on configuration, see: #   * Official English Documentation: http://nginx.org/en/docs/ #   * Official Russian Documentation: http://nginx.org/ru/docs/ user nginx; # 运行用户,默认是nginx worker_processes auto; # nginx进程数,一般设置为和cpu核数一样 error_log /var/log/nginx/error.log; # 全局错误日志路径 pid /run/nginx.pid; # 进程pid路径 # Load dynamic modules. See /usr/share/nginx/README.dynamic. # 负载动态模块 include /usr/share/nginx/modules/*.conf; events {
# 工作模式与连接数上限 worker_connections 1024; # 单个进程的最大连接数 } http {
# 设置http服务器 log_format main '$http_host $server_addr $remote_addr [$time_local] "$request" $status $request_body $body_bytes_sent "$http_referer" "$http_user_agent" $request_time $upstream_response_time'; # 设置日志的格式 access_log /var/log/nginx/access.log main; # 访问日志的路径 sendfile on; # 开启高效传输模式 tcp_nopush on; # 激活tcp_nopush参数可以允许把http response header和文件的开始放在一个文件里发布,作用是减少网络报文段的数量 tcp_nodelay on; # 激活tcp_nodelay,内核会等待将更多的字节组成一个数据包,从而提高I/O性能 keepalive_timeout 65; # 长连接超时时间,单位是秒 types_hash_max_size 2048; # 为了快速处理静态数据集,例如服务器名称, 映射指令的值,MIME类型,请求头字符串的名称,nginx使用哈希表 include /etc/nginx/mime.types; # 文件扩展名与类型映射表 default_type application/octet-stream; # 默认文件类型 # Load modular configuration files from the /etc/nginx/conf.d directory. # 加载模块化配置文件 # See http://nginx.org/en/docs/ngx_core_module.html#include # for more information. include /etc/nginx/conf.d/*.conf; server {
# 基于域名的虚拟主机 listen 80 default_server; # 监听端口 listen [::]:80 default_server; server_name _; # 域名 root /usr/share/nginx/html; # 站点根目录,即网站程序存放目录 # Load configuration files for the default server block. # 默认服务器块的加载配置文件 include /etc/nginx/default.d/*.conf; location / {
# 对“/”启用反向代理 } error_page 404 /404.html; location = /40x.html {
} error_page 500 502 503 504 /50x.html; location = /50x.html {
} } # Settings for a TLS enabled server. # # server {
# listen 443 ssl http2 default_server; # listen [::]:443 ssl http2 default_server; # server_name _; # root /usr/share/nginx/html; # # ssl_certificate "/etc/pki/nginx/server.crt"; # ssl_certificate_key "/etc/pki/nginx/private/server.key"; # ssl_session_cache shared:SSL:1m; # ssl_session_timeout 10m; # ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on; # # # Load configuration files for the default server block. # include /etc/nginx/default.d/*.conf; # # location / {
# } # # error_page 404 /404.html; # location = /40x.html {
# } # # error_page 500 502 503 504 /50x.html; # location = /50x.html {
# } # } }

转载于:https://www.cnblogs.com/yjlch1016/p/9313463.html

你可能感兴趣的文章
Linux(2)_常用命令2
查看>>
自定义分页
查看>>
[转]DELPHI——调试(1)
查看>>
JS秒数转成分秒时间格式
查看>>
xp_cmdshell 命令的开启与关闭,和状态查询
查看>>
Linux sudoers
查看>>
MySQL详解(18)-----------分页方法总结
查看>>
bzoj 4595 激光发生器
查看>>
multi cookie & read bug
查看>>
js时间转换
查看>>
(转载) Android Studio你不知道的调试技巧
查看>>
POJ2231 Moo Volume 递推 C语言
查看>>
struts2类型转换的具体流程
查看>>
Hdu 1203 I NEED A OFFER!
查看>>
php文件上传类
查看>>
CF219D Choosing Capital for Treeland
查看>>
luogu P3809 【模板】后缀排序
查看>>
Matlab画图-非常具体,非常全面
查看>>
365. Water and Jug Problem
查看>>
队列实现霍夫曼树
查看>>