#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
upstream minio-server {
# weight:默认为1。weight越大,负载的权重就越大。
# backup:其它所有的非backup机器down或者忙的时候,请求backup机器。所以这台机器压力会最轻。
# max_fails:允许请求失败的次数默认为1,当超过最大次数时,返回 proxy_next_upstream 模块定义的错误。
# fail_timeout:Nginx基于连接探测,如果发现后端异常,在单位周期为fail_timeout设置的时间中达到max_fails次数,这个周期次数内,如果后端同一个节点不可用,那么把节点标记为不可用,并等待下一个周期(同样时常为fail_timeout)再一次去请求,
判断是否连接是否成功。
server 127.0.0.1:8888 weight=2 max_fails=3 fail_timeout=10s;
server 127.0.0.1:8090 weight=1 fail_timeout=30s;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $remote_addr;
# 传输文件缓存大小及单次请求大小
client_body_buffer_size 10M;
client_max_body_size 1G;
# 宕机检测,如果设置时间内无响应,则直接切换到其它
服务
proxy_connect_timeout 4;
proxy_send_timeout 4;
proxy_read_timeout 4;
proxy_pass http://minio-server;
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#location ~ /\.ht {
# deny all;
本文转自网络,原文链接:https://developer.aliyun.com/article/784909
本站部分内容转载于网络,版权归原作者所有,转载之目的在于传播更多优秀技术内容,如有侵权请联系QQ/微信:153890879删除,谢谢!