无法理解如何重定向端口

时间:2018-01-24 17:48:19

标签: nginx

我在同一台机器上安装了一个闪亮的服务器和一个nginx服务器。 我设法访问nginx和闪亮的主页。我希望当我输入具有身份验证的nginx服务器的地址时,将我重定向到闪亮的页面,我尝试了很多指令,但没有一个工作,他们将我发送回页面d nginx错误

nginx error! The page you are looking for is temporarily unavailable. Please try again later

除了跳过身份验证的指令重写之外。

/etc/nginx/nginx.conf

# For more information on configuration, see:
#   * Official English Documentation: http://nginx.org/en/docs/
#   * Official Russian Documentation: http://nginx.org/ru/docs/
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 {
    #map $http_upgrade $connection_upgrade {
    #  default upgrade;
    #  ''      close;
    #}
    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;

    include /etc/nginx/conf.d/*.conf;
    server {
        listen       80 default_server;
        listen       [::]:80 default_server;
        server_name  httppasword_serv;

        root         /usr/share/nginx/html;
        auth_basic "Private Property";
        auth_basic_user_file /etc/nginx/.htpasswd;

        #rewrite ^ http://adress-IP-server:3838 permanent;

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

          proxy_pass http://127.0.0.1:3838;
          #proxy_redirect http://127.0.0.1:3838/ $scheme://$host/;
        }
        #upstream my_port {
         # server 127.0.0.1:3838;
        #}
        error_page 404 /404.html;
            location = /40x.html {
        }
        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }
}

/var/log/nginx/error.log

2018/01/24 17:44:45 [crit] 1701#0: *1 connect() to adress-ip-server:3838 failed (13: Permission denied) while connecting to
 upstream, client: adress-ip-client, server: httppasword_serv, request: "GET /nginx-logo.png HTTP/1.1", upstream: "http://adress-ip
server:3838/nginx-logo.png", host: "adress-ip-server", referrer: "http://adress-ip-server/"

sudo cat /var/log/audit/audit.log | grep nginx | grep被拒绝

type=AVC msg=audit(1516359636.202:668): avc:  denied  { name_connect } for  pid=5751 comm="nginx" dest=3000 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:ntop_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516359636.203:669): avc:  denied  { name_connect } for  pid=5751 comm="nginx" dest=3000 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:ntop_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516359657.422:670): avc:  denied  { name_connect } for  pid=5751 comm="nginx" dest=3000 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:ntop_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516359657.422:671): avc:  denied  { name_connect } for  pid=5751 comm="nginx" dest=3000 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:ntop_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516360479.153:798): avc:  denied  { name_connect } for  pid=5751 comm="nginx" dest=3000 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:ntop_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516360479.153:799): avc:  denied  { name_connect } for  pid=5751 comm="nginx" dest=3000 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:ntop_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516360517.474:807): avc:  denied  { name_connect } for  pid=6035 comm="nginx" dest=3000 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:ntop_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516360517.474:808): avc:  denied  { name_connect } for  pid=6035 comm="nginx" dest=3000 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:ntop_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516360531.522:809): avc:  denied  { name_connect } for  pid=6035 comm="nginx" dest=3000 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:ntop_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516360531.522:810): avc:  denied  { name_connect } for  pid=6035 comm="nginx" dest=3000 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:ntop_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516360542.292:811): avc:  denied  { name_connect } for  pid=6035 comm="nginx" dest=3000 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:ntop_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516360542.292:812): avc:  denied  { name_connect } for  pid=6035 comm="nginx" dest=3000 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:ntop_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516360732.283:835): avc:  denied  { name_connect } for  pid=6086 comm="nginx" dest=3000 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:ntop_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516360732.283:836): avc:  denied  { name_connect } for  pid=6086 comm="nginx" dest=3000 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:ntop_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516361082.068:884): avc:  denied  { name_connect } for  pid=6156 comm="nginx" dest=3000 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:ntop_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516361082.068:885): avc:  denied  { name_connect } for  pid=6156 comm="nginx" dest=3000 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:ntop_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516361212.476:909): avc:  denied  { name_connect } for  pid=6195 comm="nginx" dest=3000 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:ntop_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516361212.476:910): avc:  denied  { name_connect } for  pid=6195 comm="nginx" dest=3000 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:ntop_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516361315.831:942): avc:  denied  { name_connect } for  pid=6250 comm="nginx" dest=3000 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:ntop_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516361315.831:943): avc:  denied  { name_connect } for  pid=6250 comm="nginx" dest=3000 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:ntop_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516604013.934:328): avc:  denied  { name_connect } for  pid=1695 comm="nginx" dest=3000 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:ntop_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516604013.934:329): avc:  denied  { name_connect } for  pid=1695 comm="nginx" dest=3000 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:ntop_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516687693.897:156): avc:  denied  { name_connect } for  pid=819 comm="nginx" dest=3000 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:ntop_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516687693.907:157): avc:  denied  { name_connect } for  pid=819 comm="nginx" dest=3000 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:ntop_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516688431.742:163): avc:  denied  { name_connect } for  pid=819 comm="nginx" dest=3000 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:ntop_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516688431.742:164): avc:  denied  { name_connect } for  pid=819 comm="nginx" dest=3000 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:ntop_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516689466.033:189): avc:  denied  { name_connect } for  pid=1299 comm="nginx" dest=3000 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:ntop_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516689466.033:190): avc:  denied  { name_connect } for  pid=1299 comm="nginx" dest=3000 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:ntop_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516689495.175:191): avc:  denied  { name_connect } for  pid=1299 comm="nginx" dest=3000 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:ntop_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516689495.175:192): avc:  denied  { name_connect } for  pid=1299 comm="nginx" dest=3000 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:ntop_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516690418.202:306): avc:  denied  { name_connect } for  pid=1545 comm="nginx" dest=3000 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:ntop_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516691042.413:464): avc:  denied  { name_connect } for  pid=1545 comm="nginx" dest=3000 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:ntop_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516691325.998:515): avc:  denied  { name_connect } for  pid=1924 comm="nginx" dest=3000 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:ntop_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516693591.433:696): avc:  denied  { name_connect } for  pid=1924 comm="nginx" dest=3000 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:ntop_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516695500.311:782): avc:  denied  { name_connect } for  pid=2849 comm="nginx" dest=3838 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516695500.690:783): avc:  denied  { name_connect } for  pid=2849 comm="nginx" dest=3838 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516695501.003:784): avc:  denied  { name_connect } for  pid=2849 comm="nginx" dest=3838 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516695532.817:793): avc:  denied  { name_connect } for  pid=2849 comm="nginx" dest=3838 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516695640.154:810): avc:  denied  { name_connect } for  pid=2953 comm="nginx" dest=3838 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516695655.034:811): avc:  denied  { name_connect } for  pid=2953 comm="nginx" dest=3838 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516695710.950:826): avc:  denied  { name_connect } for  pid=2998 comm="nginx" dest=3838 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516704173.689:1085): avc:  denied  { name_connect } for  pid=5766 comm="nginx" dest=3000 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:ntop_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516704222.417:1099): avc:  denied  { name_connect } for  pid=5852 comm="nginx" dest=3838 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516704230.884:1100): avc:  denied  { name_connect } for  pid=5852 comm="nginx" dest=3838 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516705110.582:1118): avc:  denied  { name_connect } for  pid=5852 comm="nginx" dest=3838 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516705441.205:1153): avc:  denied  { name_connect } for  pid=6138 comm="nginx" dest=3000 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:ntop_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516705443.089:1154): avc:  denied  { name_connect } for  pid=6138 comm="nginx" dest=3000 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:ntop_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516705491.804:1167): avc:  denied  { name_connect } for  pid=6166 comm="nginx" dest=3000 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:ntop_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516791100.299:659): avc:  denied  { name_connect } for  pid=3772 comm="nginx" dest=3838 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516791100.682:660): avc:  denied  { name_connect } for  pid=3772 comm="nginx" dest=3838 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516791100.683:661): avc:  denied  { name_connect } for  pid=3772 comm="nginx" dest=3838 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516791170.420:679): avc:  denied  { name_connect } for  pid=3772 comm="nginx" dest=3838 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516791170.854:680): avc:  denied  { name_connect } for  pid=3772 comm="nginx" dest=3838 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516791170.867:681): avc:  denied  { name_connect } for  pid=3772 comm="nginx" dest=3838 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516793228.386:1252): avc:  denied  { name_connect } for  pid=4571 comm="nginx" dest=3838 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516793228.764:1253): avc:  denied  { name_connect } for  pid=4571 comm="nginx" dest=3838 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516793228.768:1254): avc:  denied  { name_connect } for  pid=4571 comm="nginx" dest=3838 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516793547.069:1278): avc:  denied  { name_connect } for  pid=4649 comm="nginx" dest=3838 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516793547.831:1279): avc:  denied  { name_connect } for  pid=4649 comm="nginx" dest=3838 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516793547.834:1280): avc:  denied  { name_connect } for  pid=4649 comm="nginx" dest=3838 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516793748.464:1301): avc:  denied  { name_connect } for  pid=4753 comm="nginx" dest=3838 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516793748.844:1302): avc:  denied  { name_connect } for  pid=4753 comm="nginx" dest=3838 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516793748.845:1303): avc:  denied  { name_connect } for  pid=4753 comm="nginx" dest=3838 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516794191.144:1346): avc:  denied  { name_connect } for  pid=4753 comm="nginx" dest=3838 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516794191.516:1347): avc:  denied  { name_connect } for  pid=4753 comm="nginx" dest=3838 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516794191.519:1348): avc:  denied  { name_connect } for  pid=4753 comm="nginx" dest=3838 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516794282.743:1361): avc:  denied  { name_connect } for  pid=4902 comm="nginx" dest=3838 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516794283.123:1362): avc:  denied  { name_connect } for  pid=4902 comm="nginx" dest=3838 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516794283.134:1363): avc:  denied  { name_connect } for  pid=4902 comm="nginx" dest=3838 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516794904.922:1386): avc:  denied  { name_connect } for  pid=4963 comm="nginx" dest=3838 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516794904.922:1387): avc:  denied  { name_connect } for  pid=4963 comm="nginx" dest=3838 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516795269.506:1416): avc:  denied  { name_connect } for  pid=5092 comm="nginx" dest=3838 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516795269.507:1417): avc:  denied  { name_connect } for  pid=5092 comm="nginx" dest=3838 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516796959.665:1665): avc:  denied  { name_connect } for  pid=5497 comm="nginx" dest=3838 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516796959.666:1666): avc:  denied  { name_connect } for  pid=5497 comm="nginx" dest=3838 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516814311.031:240): avc:  denied  { name_connect } for  pid=1507 comm="nginx" dest=3838 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516814311.531:241): avc:  denied  { name_connect } for  pid=1507 comm="nginx" dest=3838 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516814311.532:242): avc:  denied  { name_connect } for  pid=1507 comm="nginx" dest=3838 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516814311.907:243): avc:  denied  { name_connect } for  pid=1507 comm="nginx" dest=3838 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516814312.212:244): avc:  denied  { name_connect } for  pid=1507 comm="nginx" dest=3838 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516815884.742:283): avc:  denied  { name_connect } for  pid=1701 comm="nginx" dest=3838 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516815885.224:284): avc:  denied  { name_connect } for  pid=1701 comm="nginx" dest=3838 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket
type=AVC msg=audit(1516815885.227:285): avc:  denied  { name_connect } for  pid=1701 comm="nginx" dest=3838 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket

端口3000由nodejs auth0应用程序

使用

nginx -t

2018/01/24 20:16:44 [warn] 2267#0: the "user" directive makes sense only if the master process runs with super-user privileges, igno
red in /etc/nginx/nginx.conf:5
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
2018/01/24 20:16:44 [emerg] 2267#0: open() "/run/nginx.pid" failed (13: Permission denied)
nginx: configuration file /etc/nginx/nginx.conf test failed

1 个答案:

答案 0 :(得分:0)

您启用了SELinux或AppArmor,并将其配置为拒绝nginx打开到后端的传出连接(这可能是您的unix发布的默认设置)。

检查日志以了解原因:

cat /var/log/audit/audit.log | grep nginx | grep denied

解决方案是允许nginx网络访问(仅适用于具有SELinux的发行版):

setsebool -P httpd_can_network_connect 1

有关详细信息,请参阅:(13: Permission denied) while connecting to upstream:[nginx]