-
Notifications
You must be signed in to change notification settings - Fork 1
/
fm.lua
95 lines (84 loc) · 2.16 KB
/
fm.lua
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
worker_processes 2;
pid logs/nginx.pid;
user root;
#test
events {
use epoll;
worker_connections 2048;
}
http {
default_type application/json;
#default_type application/octet-stream;
#限制一个IP最多的并发连接数
limit_conn_zone $binary_remote_addr zone=slimits:5m;
#客户端请求包体最大值限制
client_max_body_size 100k;
log_format access_log '[$time_local] $remote_addr $request_uri '
'[$http_user_agent] $bytes_sent $request_time '
'"$request_body" $host $status';
access_log logs/access.log access_log;
error_log logs/error.log error;
keepalive_timeout 1200;
upstream mysvr{
server 192.168.1.120:8090 weight=2;
}
#下载功能
server {
listen 8000;
sendfile on;
server_name localhost;
root /home/db_bak;
autoindex on;
autoindex_exact_size off;
}
server {
listen 8090;
limit_conn slimits 5;
#开启ssl加密
ssl on;
ssl_certificate ../conf/ca.crt;
ssl_certificate_key ../conf/server.key;
#只允许post方法,如果需要get方法将 POST 改为 POST|GET
if ($request_method !~ ^(POST)$ ) {
return 444;
}
location = /user{
content_by_lua_file "nginx_lua/fm3_user.lua";
}
location = /fm{
content_by_lua_file "nginx_lua/fm3_recommend.lua";
}
location = /search{
echo_location /fm;
echo_location /index.php;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/work/php$fastcgi_script_name;
include fastcgi_params;
}
}
#虚拟主机
server {
listen 8000;
server_name 192.168.1.120;
access_log logs/mysvr.access.log access_log;
location /loadtest {
proxy_pass http://mysvr; #以这种格式来使用后端的web服务器
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
}
}