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

前端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;
}
后端的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;

}

时间: 2024-10-01 04:17:12

Tengine/2.1.2 (nginx/1.6.2) 测试配置的相关文章

Nginx作为WEB服务相关配置(性能优化,网络连接,访问控制,虚拟主机,https等等)

编译安装nginx yum -y install pcre-devel groupadd -r nginx useradd -g nginx -r nginx tar xf nginx-1.6.2.tar.gz cd nginx-1.6.2 ./configure --prefix=/usr/local/nginx --conf-path=/etc/nginx/nginx.conf--user=nginx --group=nginx --error-log-path=/var/log/nginx

12.Nginx介绍,安装,配置默认虚拟主机,重定向

[toc] 12.5 Nginx介绍 官网:nginx.org 因为nginx处理静态文件的能力要比apache好很多,所以很多企业在建站的时候一般都是用java写的,然后会选择tomcat,但是tomcat处理静态文件的能力不是太好就会叠加选择nginx. nginx特点: 体积小 处理能力强 并发高 可扩展性好 Nginx应用场景: web服务 反向代理 负载均衡 Nginx著名分支,淘宝基于Nginx开发的Tengine,使用上和Nginx一致,服务名,配置文件名都一样,和Nginx的最大

正向代理/反向代理理解、Nginx概述、安装及配置详解

一.Nginx概述 nginx是一款自由的.开源的.高性能的HTTP服务器和反向代理服务器:同时也是一个IMAP.POP3.SMTP代理服务器:nginx可以作为一个HTTP服务器进行网站的发布处理,另外nginx可以作为反向代理进行负载均衡的实现.这里主要通过三个方面简单介绍nginx:反向代理.负载均衡.nginx特点 1.反向代理 关于代理:说到代理,首先我们要明确一个概念,所谓代理就是一个代表.一个渠道: 此时就涉及到两个角色,一个是被代理角色,一个是目标角色,被代理角色通过这个代理访问

Nginx 网站服务——虚拟主机配置

第1章 Nginx 网站服务 1.1 web网站服务介绍: 1.1.1 提供静态服务的软件 Apache:这是中小型Web服务的主流,Web服务器中的老大哥. Nginx:大型网站Web服务的主流,曾经Web服务器中的初生牛犊,现已长大. Nginx的分支Tengine(http://tengine.taobao.org/)目前也在飞速发展. Lighttpd:这是一个不温不火的优秀Web软件,社区不活跃,静态解析效率很高.在Nginx流行前,它是大并发静态业务的首选,国内百度贴吧.豆瓣等众多网

Windows下Nginx Virtual Host多站点配置详解

Windows下Nginx Virtual Host多站点配置详解 此教程适用于Windows系统已经配置好Nginx+Php+Mysql环境的同学. 如果您还未搭建WNMP环境,请查看 windows7配置Nginx+php+mysql教程. 先说明一下配置多站点的目的:在生产环境中,如果将系统所有代码文件都放在公开目录中,则很容易被查看到系统源码,这样是很不安全的,所以需要只公开index.php的入口文件目录.而同一个服务器中,可能运行多个系统,这样就必须公开多个入口文件目录,以便用不同的

[项目构建 十三]babasport Nginx负载均衡的详细配置及使用案例详解.

在这里再次说明下, 这个项目是从网上 找到的一套学习资料, 自己在 空闲时间学习了这些东西. 这里面的code当然会有很多不完善的地方, 但是确实也能学到很多新东西.感谢看过这一些列博文和评论的小伙伴, 我把自己所看到的学到的拿到这里来分享是想和大家一起学习进步, 想听听园友给出的意见, 也是对自己学习过程的一个总结. 最后我会将这套资料的所有内容共享出来, 如果有愿意学习的同学可以下载下来使用.PS: 我自认为 这些内容对于刚工作1-2年的同学来说真的很适用. 技术无止境, 我们仍需努力! 1

THINKPHP的NGINX rewrite的两种配置

一.普通方式 server { ... location / { index index.htm index.html index.php; #访问路径的文件不存在则重写URL转交给ThinkPHP处理 if (!-e $request_filename) { rewrite ^/(.*)$ /index.php/$1 last; break; } } location ~ \.php/?.*$ { root /var/www/html/website; fastcgi_pass 127.0.0

Nginx与Tomcat安装、配置与优化

Nginx与Tomcat安装.配置与优化 Nginx的安装与使用 Nginx是一款优秀的反向代理服务器 安装: rpm(或者是pkg安装),是预编译好的程序包安装 yum(或者apt-get)安装,自动联网下载安装包,自动管理依赖关系 编译安装 检查和安装依赖项 yum -y install gcc pcre pcre-devel zlib zlib-devel openssl openssl-devel configure make && make install 启动.停止.重启: 安

Nginx+Memcached+Tomcat集群配置

1.   Nginx Nginx是通过将多个Web Server绑定到同一个IP地址下,以实现多个WebServer间的负载均衡,降低单个Web Server的负荷,以提高整体的性能与稳定性. 安装和配置Nginx的简单方式如下: 1)      下载并解压Nginx到本地目录:http://nginx.org/en/download.html 2)      对Nginx的配置主要是对它的配置文件/conf/nginx.conf的修改.如下链接是nginx.conf配置文件各个属性的详细说明: