1

让 Nginx yum 安装 Nginx

有 Tarantool + 墨盒

nginx.conf

upstream tarantool_httpd {
server 172.16.72.18:8082 max_fails=1 fail_timeout=15s;
keepalive 32;   
}

  server {
        listen       80 default_server;
        listen       [::]:80 default_server;
        server_name  _;
        root         /usr/share/nginx/html;

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;


        location / {
        }

    location = /redirections
    {
        proxy_pass http://tarantool_httpd;
    }
    location = /admin
    {
        proxy_pass http://tarantool_httpd;
    }


        error_page 404 /404.html;
        location = /404.html {
        }

        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
        }
    }

当我请求 URL http://172.16.72.18/admin时,我在 access.log 中收到错误 502,在 Nginx error.log 中收到错误

connect() to 172.16.72.18:8082 failed (13: Permission denied) while connecting to upstream, client: 172.16.72.32
4

2 回答 2

0

看起来像启用了 SELinux。

检查sestatus并临时禁用sudo setenforce 0

/etc/selinux/config如果问题将得到解决,您可以通过编辑和SELINUX设置永久禁用它disabled

于 2020-10-20T07:19:05.580 回答
0

如果您不想完全禁用 SELinux(除非您确实需要这样做,否则我不建议这样做),使用此命令应该足以允许 nginx 连接到后端:

sudo setsebool -P httpd_can_network_connect on

sudo setenforce 0但是,您可能会遇到其他一些 SELinux 不兼容问题,因此在遇到任何奇怪问题之前检查是否已解决某些奇怪问题确实很有意义。

于 2020-10-20T09:20:20.107 回答