-
Notifications
You must be signed in to change notification settings - Fork 3
/
nginx.conf
executable file
·145 lines (118 loc) · 3.12 KB
/
nginx.conf
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
# 这里限定了最大工作连接数量
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
client_max_body_size 1024m;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# SSL Settings
##
# 证书公钥
#ssl_certificate /root/cert/fullchain.crt;
# 证书私钥
#ssl_certificate_key /root/cert/private.key;
#缓存大小 1MB大约4000个会话
# ssl_session_cache shared:SSL:10m;
#过期时间 1M = 1分钟
# ssl_seesion_timeout 10m;
#证书协议优先级 设置TLS为1.2版本、ios的TLS必须要1.2
# ssl_protocols SSLv2 SSLv3 TLSv1 TLSv1.1 TLSv1.2;
#TLS缓冲区设置默认为16KB
# ssl_buffer_size 1400;
#记录ssl连接信息
#ssl_log /path/to/ssl.log ssl;
ssl_prefer_server_ciphers on;
##
# Logging Settings
##
access_log /yzx/src/SimpleTikTok/bin/logs/access.log;
error_log /yzx/src/SimpleTikTok/bin/logs/error.log;
# access_log /var/log/nginx/access.log;
# error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
# 漏桶限流,rate为速率
# contentRateLimit用于设定空间大小,用于储存桶请求,1M能存储16000 IP地址的访问信息。
limit_req_zone $binary_remote_addr zone=MyRateLimit:10m rate=15r/s;
server {
listen 4444; #服务器端口
#listen 5555 ssl;
listen [::]:4444;
server_name localhost; #服务器域名
location ~/douyin/feed/ {
proxy_pass http://127.0.0.1:8888;
}
location ~/douyin/user/ {
# 漏桶设置应用
# burst为桶的大小,nodela表示不延时,立即处理
limit_req zone=MyRateLimit burst=5 nodelay;
proxy_pass http://127.0.0.1:8888;
}
location ~/douyin/publish/ {
proxy_pass http://127.0.0.1:8888;
}
location ~/douyin/relation/ {
proxy_pass http://127.0.0.1:8810;
}
location ~/douyin/message/ {
proxy_pass http://127.0.0.1:8810;
}
location ~/douyin/comment/ {
proxy_pass http://127.0.0.1:8889;
}
location ~/douyin/favorite/ {
proxy_pass http://127.0.0.1:8889;
}
}
}
#mail {
# # See sample authentication script at:
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
# # auth_http localhost/auth.php;
# # pop3_capabilities "TOP" "USER";
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
# server {
# listen localhost:110;
# protocol pop3;
# proxy on;
# }
#
# server {
# listen localhost:143;
# protocol imap;
# proxy on;
# }
#}