在使用nginx做负载均衡的时候,结合ceph对象网关

    1.ceph配置

    1. ceph配置并没有做任何修改

    2.nginx做配置

    nginx配置

    1. # For more information on configuration, see:
    2. # * Official English Documentation: http://nginx.org/en/docs/
    3. # * Official Russian Documentation: http://nginx.org/ru/docs/
    4. #user nginx;
    5. user root;
    6. #worker_processes 4;
    7. worker_processes auto;
    8. #worker_cpu_affinity 0001 0010 0100 1000;
    9. error_log /var/log/nginx/error.log;
    10. pid /var/run/nginx.pid;
    11. #worker_rlimit_nofile 204800;
    12. # Load dynamic modules. See /usr/share/nginx/README.dynamic.
    13. include /usr/share/nginx/modules/*.conf;
    14. events {
    15. worker_connections 2048000;
    16. }
    17. http {
    18. log_format main '$remote_addr - $remote_user [$time_local] "$request" '
    19. '$status $body_bytes_sent "$http_referer" '
    20. '"$http_user_agent" "$http_x_forwarded_for"';
    21. access_log /var/log/nginx/access.log main;
    22. sendfile on;
    23. tcp_nopush on;
    24. tcp_nodelay on;
    25. types_hash_max_size 2048;
    26. include /etc/nginx/mime.types;
    27. default_type application/octet-stream;
    28. charset utf-8;
    29. server_names_hash_bucket_size 8096;
    30. client_header_buffer_size 8096k;
    31. large_client_header_buffers 4 8096k;
    32. client_max_body_size 1000m;
    33. client_body_buffer_size 8m;
    34. keepalive_timeout 120;
    35. fastcgi_connect_timeout 300;
    36. fastcgi_send_timeout 300;
    37. fastcgi_read_timeout 300;
    38. fastcgi_buffer_size 10240k;
    39. fastcgi_buffers 16 10240k;
    40. fastcgi_busy_buffers_size 10240k;
    41. fastcgi_temp_file_write_size 10240k;
    42. fastcgi_cache_valid 200 302 1h;
    43. fastcgi_cache_valid 301 1d;
    44. fastcgi_cache_valid any 1m;
    45. fastcgi_cache_min_uses 1;
    46. fastcgi_cache_use_stale error timeout invalid_header http_500;
    47. open_file_cache max=204800 inactive=20s;
    48. open_file_cache_min_uses 1;
    49. open_file_cache_valid 30s;
    50. gzip on;
    51. gzip_min_length 1k;
    52. gzip_buffers 4 16k;
    53. gzip_http_version 1.0;
    54. gzip_comp_level 2;
    55. gzip_types text/plain application/x-javascript text/css application/xml;
    56. gzip_vary on;
    57. # Load modular configuration files from the /etc/nginx/conf.d directory.
    58. # See http://nginx.org/en/docs/ngx_core_module.html#include
    59. # for more information.
    60. include /etc/nginx/conf.d/*.conf;
    61. }

    3.s3配置信息

    1. upstream s3lb {
    2. server 192.168.1.61:7480 weight=1;
    3. server 192.168.1.62:7480 weight=1;
    4. server 192.168.1.63:7480 weight=1;
    5. }
    6. server {
    7. listen 80;
    8. server_name 192.168.1.64;
    9. access_log /var/log/nginx/s3lb.access.log main;
    10. error_log /var/log/nginx/s3lb.error.log;
    11. root html;
    12. index index.html index.htm index.php;
    13. ## send request back to apache ##
    14. location / {
    15. proxy_pass http://s3lb;
    16. #Proxy Settings
    17. proxy_redirect off;
    18. proxy_set_header Host $host;
    19. proxy_set_header X-Real-IP $remote_addr;
    20. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    21. proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
    22. proxy_max_temp_file_size 0;
    23. proxy_connect_timeout 90;
    24. proxy_send_timeout 90;
    25. proxy_read_timeout 90;
    26. proxy_buffer_size 4k;
    27. proxy_buffers 4 32k;
    28. proxy_busy_buffers_size 64k;
    29. proxy_temp_file_write_size 64k;
    30. }
    31. }