node.js - 无法让 Node 服务器代理到 RedHat Ec2 实例上的 nginx

标签 node.js amazon-web-services nginx amazon-ec2 proxy

我有一个 redhat Ec2 实例。我有一个简单的 Express 应用程序在端口 3000 上运行。我安装了 nginx 并且它运行正常,因为我能够将 s3 存储桶静态站点代理到我正在使用的其他子域。但是,当我尝试将 Express 应用程序代理到我的子域之一时,我不断收到 nginx 失败页面。这是我正在使用的 nginx 配置 block :

server {
    listen       80;
    listen      api.subdoamin.com:80;
    server_name  api.grouve.tech;
    root         /usr/share/nginx/html;

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

    location / {
            proxy_pass http://00.000.00.000:3000;
            expires 1y;
            log_not_found off;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection 'upgrade';
            proxy_set_header Host $host;
            proxy_cache_bypass $http_upgrade;
    }
     error_page 404 /404.html;
        location = /40x.html {
    }

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

最佳答案

感谢@DusanBajic,答案是sudo setenforce 0

关于node.js - 无法让 Node 服务器代理到 RedHat Ec2 实例上的 nginx,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44374766/

相关文章:

nginx - 如何在NGINX中获取URL的子域

javascript - node.js 如何使用 url 作为 pdf 路径来使用 pdf2json

javascript - 如何在客户端断开连接时向房间客户端发送消息

node.js - 如何使用 KeyConditionExpression 查询 AWS DynamoDb?

amazon-web-services - 向 Slack 发送 SNS 通知

google-chrome - 被 CORS 策略阻止的 CORS 策略阻止的 Cloudfront CDN 字体 : No 'Access-Control-Allow-Origin' header is present on the requested resource

javascript - 我如何解析这个包含\n的变量?

reactjs - 如何使用 react 和 django rest 框架将图像上传到 aws s3

node.js - Lambda 函数测试永远不会通过

php+nginx+vagrant - php 无法写入