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 2021-02-24 15:46  木林coder  阅读(70)  评论(0编辑  收藏  举报

导航