当前位置首页 > Nginx知识

ceph搭建nginx负载3个对象网关

阅读次数:236 次  来源:admin  发布时间:

ceph搭建nginx负载3个对象网关

ginx.conf

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

# Load dynamic modules. See /usr/share/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;

events {
    worker_connections 1024;
}

http {
        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 /var/log/nginx/access.log main;
        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 65;
        types_hash_max_size 2048;
        include /etc/nginx/mime.types;
        default_type application/octet-stream;
        # Load modular configuration files from the /etc/nginx/conf.d directory.
        # See http://nginx.org/en/docs/ngx_core_module.html#include
        # for more information.
        include /etc/nginx/conf.d/*.conf;
        server {
                listen 80 default_server;
                listen [::]:80 default_server;
                server_name cephcloud.com;

                # Load configuration files for the default server block.
                include /etc/nginx/default.d/*.conf;
                if ($host ~* (.*)\.cephcloud\.com$){
                        set $sub_dom '$1';
                        rewrite ^(.*)$ /$sub_dom$1 last;
                        }
                location /{

roxy_set_header Host $host

roxy_set_header X-Forwarded-For $remote_addr

roxy_set_header X-Forwarded-Host $server_name

roxy_set_header X-Real-IP $remote_addr

                        proxy_pass http://ceph_radosgw_zone;
                        }
        }
}

upstream.conf

upstream ceph_radosgw_zone {
    server mon-node1:7480  weight=1 max_fails=2 fail_timeout=5;
    server mon-node2:7480  weight=1 max_fails=2 fail_timeout=5;
    server mon-node3:7480  weight=1 max_fails=2 fail_timeout=5;
}

/etc/host

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
10.101.0.102 admin-node  cephcloud.com
10.101.0.95 mon-node1
10.101.0.96 mon-node2
10.101.0.97 mon-node3
10.101.0.98 data-node1
10.101.0.99 data-node2
10.101.0.100 data-node3
127.0.0.1 cephcloud.com

ceph搭建nginx负载3个对象网关

上一篇:Centos中yum方式安装java
下一篇:ApacheHadoop2.9.2的Federation架构设计