1. 安装nginx
    2. 配置nginx配置文件
    1. [root@s4 nginx]# cat nginx.conf
    2. user nginx;
    3. worker_processes 1;
    4. error_log /var/log/nginx/error.log warn;
    5. pid /var/run/nginx.pid;
    6. events {
    7. worker_connections 1024;
    8. }
    9. http {
    10. include /etc/nginx/mime.types;
    11. default_type application/octet-stream;
    12. log_format main '$remote_addr - $remote_user [$time_local] "$request" '
    13. '$status $body_bytes_sent "$http_referer" '
    14. '"$http_user_agent" "$http_x_forwarded_for"';
    15. access_log /var/log/nginx/access.log main;
    16. sendfile on;
    17. #tcp_nopush on;
    18. keepalive_timeout 65;
    19. #gzip on;
    20. include /etc/nginx/conf.d/*.conf;
    21. upstream bk_radosgw
    22. {
    23. server 192.168.0.61:7480;
    24. server 192.168.0.62:7480;
    25. server 192.168.0.63:7480;
    26. }
    27. server
    28. {
    29. listen *:80;
    30. location /
    31. {
    32. include fastcgi_params;
    33. fastcgi_pass_header Authorization;
    34. fastcgi_pass_request_headers on;
    35. fastcgi_pass bk_radosgw;
    36. }
    37. }
    38. }

    第二个版本

    1. [root@s4 nginx]# cat /etc/nginx/nginx.conf
    2. #user nginx;
    3. user root;
    4. worker_processes auto;
    5. error_log /var/log/nginx/error.log;
    6. pid /run/nginx.pid;
    7. # Load dynamic modules. See /usr/share/nginx/README.dynamic.
    8. include /usr/share/nginx/modules/*.conf;
    9. events {
    10. worker_connections 1024;
    11. }
    12. http {
    13. log_format main '$remote_addr - $remote_user [$time_local] "$request" '
    14. '$status $body_bytes_sent "$http_referer" '
    15. '"$http_user_agent" "$http_x_forwarded_for"';
    16. access_log /var/log/nginx/access.log main;
    17. sendfile on;
    18. tcp_nopush on;
    19. tcp_nodelay on;
    20. keepalive_timeout 65;
    21. types_hash_max_size 2048;
    22. include /etc/nginx/mime.types;
    23. default_type application/octet-stream;
    24. # Load modular configuration files from the /etc/nginx/conf.d directory.
    25. # See http://nginx.org/en/docs/ngx_core_module.html#include
    26. # for more information.
    27. include /etc/nginx/conf.d/*.conf;
    28. upstream s3 {
    29. server 192.168.1.61:7480 max_fails=5 fail_timeout=60s;
    30. server 192.168.1.62:7480 max_fails=5 fail_timeout=60s;
    31. server 192.168.1.63:7480 max_fails=5 fail_timeout=60s;
    32. }
    33. server {
    34. listen 80 default_server;
    35. listen [::]:80 default_server;
    36. server_name s4;
    37. # Load configuration files for the default server block.
    38. include /etc/nginx/default.d/*.conf;
    39. location /{
    40. proxy_pass http://s3;
    41. }
    42. }
    43. }

    问题1。

    1. 修改nginx.conf文件后,重启后出现的问题
    2. nginx: [emerg] chown("/var/cache/nginx/client_temp", 0) failed (13: Permission denied)

    解决方案:

    1. # cd /var/cache/nginx/
    2. # chown root ./* -R

    问题2

    1. 修改以上问题后,出现了502错误,由于没有关闭selinux

    解决方案:

    1. SELINUX=enforcing 修改为
    2. SELINUX=disabled