目录

目录结构与Nginx多进程模型

# 目录结构

在手动安装完Nginx后,所有文件将放置在/usr/local/nginx

  1. html - 存放网页的文件夹
  2. logs - 存放日志
  3. sbin - 启动
  4. conf - 配置文件

# 多进程模型

Nginx分为Master进程和worker进程 Master进程负责管理worker进程 worker进程负责接收处理外部请求 ![[Pasted image 20220519152315.png]]

# 配置文件

以下是最简单的配置文件

# worker进程的数量  
worker_processes  1;  
  
events {  
    # 每个worker可以创建多少连接  
    worker_connections  1024;  
}  
  
  
http {  
    # 决定返回文件的类型,例如: jpg, html, css...  
    # mime.types可以查看conf/mime.types  
    include       mime.types;  
    
    # 如果不包含在mime.types里,则默认为application/octet-stream  
    default_type  application/octet-stream;  
  
    sendfile        on;
    
    # 响应超时范围  
    keepalive_timeout  65;  
  
    # 虚拟主机  
    server {  
        # 监听端口号  
        listen       80;  
        
        # 服务器IP  
        server_name  localhost;  
  
        location / {  
  
            # 页面资源的存放目录,这里是../html下  
            root   html;  
            index  index.html index.htm;  
        }  
        # 当响应是500 502 503 504时 返回50x.html页面  
        error_page   500 502 503 504  /50x.html;
        
        # 当用户访问50x.html找不到时,会去../html目录下找  
        location = /50x.html {  
            root   html;  
        }  
    }  
}
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
最近更新
01
基本知识
07-18
02
卷积神经网络识别图像
07-18
03
损失函数
07-18
更多文章>