Tengine/2.1.2 (nginx/1.6.2) 测试配置

简介:
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
前端tenginx 配置
 
cat  / usr / local / tengine / conf / nginx.conf
user nginx nginx;
                                                                                                                                                                                                                                           
worker_processes auto;
worker_cpu_affinity auto;
                                                                                                                                                                                                                                           
error_log  / var / log / tengine / error.log crit;
pid  / var / run / nginx.pid;
google_perftools_profiles  / var / tmp / tcmalloc;
                                                                                                                                                                                                                                           
worker_rlimit_nofile  65535 ;
                                                                                                                                                                                                                                           
dso {
     load ngx_http_rewrite_module.so;
     load ngx_http_access_module.so;
     load ngx_http_concat_module.so;
     load ngx_http_limit_conn_module.so;
     load ngx_http_limit_req_module.so;
     load ngx_http_upstream_session_sticky_module.so;
     load ngx_http_cache_purge_module.so;
     load ngx_http_trim_filter_module.so;
}
                                                                                                                                                                                                                                           
events {
     use epoll;
     worker_connections  10240 ;
}
                                                                                                                                                                                                                                           
http {
  
     proxy_ignore_client_abort on;
     add_header Access - Control - Allow - Origin  * ;
     server_tokens off;
     server_tag off;
     autoindex off;
     access_log off;
     include mime.types;
     default_type application / octet - stream;
                                                                                                                                                                                                                                              
     server_names_hash_bucket_size  128 ;
     client_header_buffer_size  32k ;
     large_client_header_buffers  4  32k ;
     client_max_body_size  10m ;
     client_body_buffer_size  256k ;
                                                                                                                                                                                                                                              
     sendfile on;
     tcp_nopush on;
     keepalive_timeout  60 ;
     tcp_nodelay on;
                                                                                                                                                                                                                                              
     gzip on;
     gzip_min_length  1k ;
     gzip_buffers  4  16k ;
     gzip_http_version  1.0 ;
     gzip_comp_level  2 ;
     gzip_types text / plain application / x - javascript text / css application / xml;
     gzip_vary on;
                                                                                                                                                                                                                                              
     proxy_connect_timeout  600 ;
     proxy_read_timeout  600 ;
     proxy_send_timeout  600 ;
     proxy_buffer_size  128k ;
     proxy_buffers  4  128k ;
     proxy_busy_buffers_size  256k ;
     proxy_temp_file_write_size  256k ;
     proxy_headers_hash_max_size  1024 ;
     proxy_headers_hash_bucket_size  128 ;
                                                                                                                                                                                                                                              
     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;
                                                                                                                                                                                                                                              
     proxy_temp_path  / data / nginx_temp / nginx_temp;
     proxy_cache_path  / data / nginx_temp / nginx_cache levels = 1 : 2  keys_zone = cache_one: 2048m  inactive = 30m  max_size = 60g ;
                                                                                                                                                                                                                                              
     include  SET / * .conf;
                                                                                                                                                                                                                                              
     
     log_format access  '$HTTP_X_REAL_IP - $remote_user [$time_local] "$request"'
          '$status $body_bytes_sent "$http_referer" '
          '"$http_user_agent" $HTTP_X_Forwarded_For' ;
                                                                                                                                                                                                                                         
     server {
         sysguard on;
                                                                                                                                                                                                                                                  
         sysguard_load load = 10.5  action = / loadlimit;
         sysguard_mem swapratio = 20 %  action = / swaplimit;
         sysguard_mem free = 100M  action = / freelimit;
                                                                                                                                                                                                                                                  
         location  / loadlimit {
             return  503 ;
         }
                                                                                                                                                                                                                                                  
         location  / swaplimit {
             return  503 ;
         }
                                                                                                                                                                                                                                                  
         location  / freelimit {
             return  503 ;
         }
     }
                                                                                                                                                                                                                                              
                                                                                                                                                                                                                                              
     include   / usr / local / tengine / conf / conf.d / * .conf;
}
 
 
cat cdn.conf
server {
         listen   80 ;
         server_name     cdn.com;
         error_log       cdn.error;
 
if  ($time_iso8601 ~  "^(d{4})-(d{2})-(d{2})T(d{2}):(d{2}):(d{2})" )
{
set  $year1 $ 1 ;
set  $month1 $ 2 ;
set  $day1 $ 3 ;
set  $hour1 $ 4 ;
set  $minutes1 $ 5 ;
set  $seconds1 $ 6 ;
}
access_log   / opt / log / cdn - $year - $month - $day.log;
 
location  / webscan_360_cn.html
{
root  / usr / local / tengine / html / cdn;
}
 
location  /  {
       proxy_pass http: / / ip2: 8180 / ;   
}
}
 
cat h5.conf
server {
     listen  80 ;
     server_name h5.com;
     index index.html index.htm index.php;
     access_log on;
                                                                                                                                                                               
     trim on;
     location  / webscan_360_cn.html
{
root  / usr / local / tengine / html / h5;
}
 
                                                                                                                                                                               
     location  /  {
         proxy_next_upstream http_500 http_502 http_503 http_504 error timeout invalid_header;
         proxy_pass http: / / h5;
         
    if  ($http_range ~  "\d{9,}" ) {
     return  444 ;
      }
    if  ( $host !~ *  'h5.com'  ) {
     return  403 ;
    }
    }                                                                                                  location ~ . * \.(php)?$ {
         proxy_next_upstream http_500 http_502 http_503 http_504 error timeout invalid_header;
         proxy_pass http: / / h5;
     }
                                                                                                                                                                                                                                                                                                                                                             
     location ~  / purge( / . * ) {
         allow  127.0 . 0.1 ;
         allow  198.x .x. 0 / 24 ;
         deny  all ;
     }
                                                                                                                                                                               
     location ~ . * \.(htm|js|css|gif|jpg|jpeg|png|bmp|ico|swf|flv)$ {
         proxy_next_upstream http_500 http_502 http_503 http_504 error timeout invalid_header;
         proxy_cache cache_one;
         proxy_cache_valid  200  304  15m ;
         proxy_cache_valid  301  302  10m ;
         proxy_cache_valid  any  1m ;
         proxy_cache_key $host$uri$is_args$args;
         add_header Ten - webcache  '$upstream_cache_status from $host' ;
         proxy_pass http: / / h5;
         expires  30m ;
     }
                   
     #上满这段无效                                                                                                                                                            
     location ~  / \.ht {
         deny  all ;
     }
                                                                                                                                                                               
     access_log  / data / logs / web / h5 / access.log access;
}
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
后端的nginx 配置(ip2)
cat cdn.conf
server {
         listen   8180 ;
         server_name     cdn.com;
         access_log      cdn.log;
         error_log       cdn.error;
         root xx;
         location  /  {
          index index.php index.html index.htm;
     }
     location ~ ^ / (images|javascript|js|css|flash|media|static|html) /  {
expires  10s ;
}
 
location ~ .php$ {
             fastcgi_pass  127.0 . 0.1 : 9000 ;
             fastcgi_index index.php;
             fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
             include fastcgi_params;
         }
 
location ~  / .ht {
             deny  all ;
         }
 
}


查看后端服务器状态

location /nstatus {

check_status;

#access_log off;

#allow SOME.IP.ADD.RESS;

#deny all;

}     

wKiom1lVu_6DIfJpAAAvZJVdj58169.png-wh_50

wKiom1lVvAfzYtoEAAA8JYqf0rY470.png-wh_50



本文转自 liqius 51CTO博客,原文链接:http://blog.51cto.com/szgb17/1943401,如需转载请自行联系原作者

相关文章
|
4月前
|
应用服务中间件 Linux 网络安全
Centos 8.0中Nginx配置文件和https正书添加配置
这是一份Nginx配置文件,包含HTTP与HTTPS服务设置。主要功能如下:1) 将HTTP(80端口)请求重定向至HTTPS(443端口),增强安全性;2) 配置SSL证书,支持TLSv1.1至TLSv1.3协议;3) 使用uWSGI与后端应用通信(如Django);4) 静态文件托管路径设为`/root/code/static/`;5) 定制错误页面(404、50x)。适用于Web应用部署场景。
595 87
|
4月前
|
负载均衡 应用服务中间件 nginx
Nginx配置与命令
Nginx 是一款高性能的 HTTP 和反向代理服务器,其配置文件灵活且功能强大。本文介绍了 Nginx 配置的基础结构和常用指令,包括全局块、Events 块、HTTP 块及 Server 块的配置方法,以及静态资源服务、反向代理、负载均衡、HTTPS 和 URL 重写等功能实现。此外,还提供了常用的 Nginx 命令操作,如启动、停止、重载配置和日志管理等,帮助用户高效管理和优化服务器性能。
|
2月前
|
应用服务中间件 网络安全 nginx
配置Nginx以支持Websocket连接的方法。
通过上述配置,Nginx将能够理解WebSocket协议的特殊要求,代理Websocket流量到合适的后端服务器。注意,Websocket并不是HTTP,尽管它最初是通过HTTP请求启动的连接升级,因此保证Nginx了解并能够妥善处理这种升级流程是关键。
480 10
|
3月前
|
安全 应用服务中间件 网络安全
Nginx SSL/TLS协议栈中配置深度解析与实践指南-优雅草卓伊凡
Nginx SSL/TLS协议栈中配置深度解析与实践指南-优雅草卓伊凡
238 0
Nginx SSL/TLS协议栈中配置深度解析与实践指南-优雅草卓伊凡
|
3月前
|
JSON 前端开发 应用服务中间件
配置Nginx根据IP地址进行流量限制以及返回JSON格式数据的方案
最后,记得在任何生产环境部署之前,进行透彻测试以确保一切运转如预期。遵循这些战术,守卫你的网络城堡不再是难题。
184 3
|
8月前
|
运维 关系型数据库 MySQL
os-copilot安装_配置_功能测试全集
我是一位中级运维工程师,我平时工作会涉及到 各类服务器的 数据库 与 java环境配置 操作。 我顺利使用了OS Copilot的 -t -f | 功能,我的疑惑是不能在自动操作过程中直接给与脚本运行权限,必须需要自己运行一下 chmod 这个既然有了最高的权限,为什么就不能直接给与运行权限呢。 我认为 -t 功能有用,能解决后台运行基础命令操作。 我认为 -f 功能有用,可以通过task文件中撰写连续任务操作。 我认为 | 对文件理解上有很直接的解读,可以在理解新程序上有很大帮助。
263 86
|
8月前
|
人工智能 Ubuntu Linux
os-copilot使用之全面配置与使用测试
作为一名个人开发者,我主要从事云服务器架设工作。近期,我成功使用了OS Copilot的 `-t -f |` 功能,解决了执行语句、连续提问及快速理解文件的问题。我发现这些功能非常实用,特别是在使用Workbench时能快速调用AI助手。此外,建议将AI功能与xShell工具联动,进一步提升效率。文中详细记录了购买服务器、远程连接、安装配置OS Copilot以及具体命令测试的过程,展示了如何通过快捷键和命令行操作实现高效开发。
279 67
|
6月前
|
应用服务中间件 nginx
Nginx进程配置指令详解
Nginx进程配置指令主要包括:`worker_processes`设置工作进程数;`worker_cpu_affinity`绑定CPU核心;`worker_rlimit_nofile`设置最大文件描述符数量;`worker_priority`设置进程优先级;`worker_connections`设置最大连接数;`daemon`控制守护进程模式;`master_process`启用主进程模式;`pid`设置PID文件路径;`user`指定用户和组;`error_log`配置错误日志。这些指令在`nginx.conf`中配置,用于优化和控制Nginx的运行行为。
278 10
|
7月前
|
缓存 Java 测试技术
【01】噩梦终结flutter配安卓android鸿蒙harmonyOS 以及next调试环境配鸿蒙和ios真机调试环境-flutter项目安卓环境配置-gradle-agp-ndkVersion模拟器运行真机测试环境-本地环境搭建-如何快速搭建android本地运行环境-优雅草卓伊凡-很多人在这步就被难倒了
【01】噩梦终结flutter配安卓android鸿蒙harmonyOS 以及next调试环境配鸿蒙和ios真机调试环境-flutter项目安卓环境配置-gradle-agp-ndkVersion模拟器运行真机测试环境-本地环境搭建-如何快速搭建android本地运行环境-优雅草卓伊凡-很多人在这步就被难倒了
767 3
【01】噩梦终结flutter配安卓android鸿蒙harmonyOS 以及next调试环境配鸿蒙和ios真机调试环境-flutter项目安卓环境配置-gradle-agp-ndkVersion模拟器运行真机测试环境-本地环境搭建-如何快速搭建android本地运行环境-优雅草卓伊凡-很多人在这步就被难倒了
|
8月前
|
存储 应用服务中间件 Linux
nginx配置证书和私钥进行SSL通信验证
nginx配置证书和私钥进行SSL通信验证
378 4