nginx配置详解

nginx的配置在nginx下的conf/nginx.conf

worker_processes  1;      进程为1,可以往高调,一般设置为 CPU数*核数

#error_log  logs/error.log;  错误日志存放的位置

#pid        logs/nginx.pid;     pid文件存放的位置

events {  

  use epoll;   使用epoll的I/O 模型。nginx一般都用epoll

worker_connections  1024;    这是一个子进程的连接数,可以调高 

keepalive_timeout 60;     高可用的超时时间

}

http {

  include  mime.type:  //设定mime类型,类型由mime.type文件定义

  default_type  application/octet-stream;

   #access_log  logs/access.log  main;    访问日志的开启和路径

  sendfile  on;

  keepalived_timeout  65;

  #gzip  on;  是否开启gzip压缩

  server  {

    lsten  80;  监控的端口

    server_name   www.yunwei.com; 域名 

  location / {  我的个人理解为这也是个location匹配规则

    root  html;  web的主页也是根目录

    index  index.html  test.php; 页面的类型   

    }

  error_page  500  502 503 504  /504.html;

  location  =  /50x.html  {

    root  html;  错误码的值

  }

 }

}

三、详细讲解(点击下面连接跳转到具体详细讲解页面)
1.nginx超详细讲解之概述
2.nginx超详细讲解之server,log
3.nginx超详细讲解之location,rewrite,反向代理及负载均衡
4.nginx超详细讲解之压缩和缓存

 

posted @ 2018-04-16 13:41  Nan得糊涂  阅读(136)  评论(0编辑  收藏  举报