nginx.conf-2

server {
listen 80;
server_name 120.78.64.28;

location / {
limit_req zone=one ;
    root   /usr/local/nginx/html;
    index  index.html index.htm index.php;
#if ($http_user_agent ~* (mobile|nokia|iphone|ipad|android|samsung|htc|blackberry)) { rewrite ^(.*) http://www.baidu.com$1 permanent; }
#default_type text/html;
#return 200 $remote_addr;
#return 200 $http_user_agent;
}
location /api {
rewrite ^/api/(.*)/(.*)/(.*)/(.*)$ /api/index.php?$1=$2&$3=$4 last; 
break;

}
location /cache {
expires 30m;
proxy_cache my_cache;

}
location /upstream {
default_type text/html;
return 200 $scheme$proxy_host$uri$is_args$args;
proxy_cache my_cache;
proxy_cache_valid any 1m;
proxy_cache_key $scheme$proxy_host$uri$is_args$args;
proxy_ignore_headers Cache-Control;
proxy_cache_bypass 1;

proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Real-PORT $remote_port;	

proxy_next_upstream timeout;
proxy_next_upstream_tries 1;
proxy_next_upstream_timeout 1;
proxy_send_timeout 3;
proxy_read_timeout 4;
proxy_connect_timeout 3;
proxy_pass http://swoole_server;
}
location ~* ^.+\.(jpg|gif|png|swf|flv|wma|wmv|asf|mp3|mmf|zip|rar)$ {
valid_referers 120.78.64.28  www.baidu.com;
if ($invalid_referer) {
    return 200 $remote_addr;break;
}

}
error_page   500 502 503 504  /50x.html;
location = /50x.html {
    root   /usr/local/nginx/html;
}

location ~ \.php$ {
    fastcgi_pass   120.78.64.28:9000;
fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  /www/$fastcgi_script_name;
    include        fastcgi_params;
}

location =/test {
    default_type text/html;
    return 200 'test1';
}

location /test {
    default_type text/html;
    return 200 'test2';
}

}

posted on   木林coder  阅读(77)  评论(0编辑  收藏  举报

编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· DeepSeek 开源周回顾「GitHub 热点速览」
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
点击右上角即可分享
微信分享提示