欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

nginx配置_仅参考

程序员文章站 2024-03-21 14:53:28
...

cat laifeng_newlog.conf
log_format laifeng_newlog_main '$http_x_forwarded_for $time_local $request $status $http_user_agent $http_x_forwarded_for $request_time $connection $http_referer';

server {
listen 80;
server_name log.laifeng.com;

location /log/client {
default_type "text/html";
content_by_lua_file /opt/lua/content.lua;
access_log /opt/logs/nginx/access/laifeng_newlog.log laifeng_newlog_main;
}

client_max_body_size 10M;

location ~ ^/logger.jsp {
return 404;
access_log off;
}

location = /v1/gift/show_resources {
return 404;
access_log off;
}

location = /v1/sdk/level/user {
return 404;
access_log off;
}

location = /v1/sdk/level/anchor {
return 404;
access_log off;
}

location = /v1/sdk/gift/get {
return 404;
access_log off;
}

location = /v1/sdk/gift/sign {
return 404;
access_log off;
}

}



upstream log_laifeng_com {
# hash $http_x_forwarded_for;
server 10.100.20.25:8083 max_fails=3 fail_timeout=30s;
server 10.100.20.26:8083 max_fails=3 fail_timeout=30s;
}

#upstream BIND_laifeng_com {
# hash $http_x_forwarded_for;
# server 10.100.20.25:8082 max_fails=3 fail_timeout=30s;
# server 10.100.20.26:8082 max_fails=3 fail_timeout=30s;
# }


log_format laifeng_log_main '$http_x_forwarded_for $time_local $request $status $http_user_agent $http_x_forwarded_for $request_time $connection $http_referer';

server {
listen 80;
server_name log.laifeng.com;

#location = /lvs/lvs.html {
# default_type "text/html;charset=UTF-8";
# return 200 "Hello World";
#}

client_max_body_size 10M;

location ~ ^/logger.jsp {
return 404;
access_log off;
}

location = /v1/gift/show_resources {
return 404;
access_log off;
}

location = /v1/sdk/level/user {
return 404;
access_log off;
}

location = /v1/sdk/level/anchor {
return 404;
access_log off;
}

location = /v1/sdk/gift/get {
return 404;
access_log off;
}

location = /v1/sdk/gift/sign {
return 404;
access_log off;
}

###################### 2015-07-11/活动应急备用 ######################
# location = /redirect.html {
# if ( $request_uri ~ "/(.*).html\?id=(000145d3|000145d0|000145d4|000145d5)$" )
# {
# rewrite ^/(.*) http://www.laifeng.com/lizhiting? redirect;
# }
# proxy_next_upstream http_502 http_504 error timeout invalid_header;
# 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_pass http://cps.laifeng.com;
# access_log /opt/logs/nginx/access/laifeng_cps.log laifeng_cps_main;
# }

####################### 2015-08-06 #########################
# location /bind {
# proxy_next_upstream http_502 http_504 error timeout invalid_header;
# 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_pass http://BIND_laifeng_com;
# access_log /opt/logs/nginx/access/laifeng_cps.log laifeng_cps_main;
# }

location / {
proxy_next_upstream http_502 http_504 error timeout invalid_header;
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_pass http://log_laifeng_com;
access_log /opt/logs/nginx/access/laifeng_log.log laifeng_log_main;
}
}