2017-06-05 27 views
1

我有一个redhat Ec2实例。我有一个简单的Express App在port 3000上运行。我安装了nginx,它运行正常,因为我可以将s3桶静态网站代理到我正在使用的其他子域。但是,当我尝试将我的快速应用程序代理到其中一个子域时,我一直在获取nginx失败页面。这里是我的nginx的配置块,我使用:无法让节点服务器代理到RedHat Ec2实例上的nginx

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 { 
    } 
} 
+1

的节点和nginx的同一实例上运行? –

+0

是的,他们在同一个实例上运行。我的节点应用程序运行在/ opt/api –

+0

然后您应该尝试使用'proxy_pass http://127.0.0.1:3000;' –

回答

1

由于@DusanBajic答案是sudo setenforce 0

+0

请记住,此修复无法在重新启动后存活,您需要永久禁用selinux([fedora](https://docs.fedoraproject.org/en-US/Fedora/11/html/Security-Enhanced_Linux) /sect-Security-Enhanced_Linux-Enabling_and_Disabling_SELinux-Disabling_SELinux.html),[centos](https://www.centos.org/docs/5/html/5.1/Deployment_Guide/sec-sel-enable-disable.html)) –

+0

谢谢@DusanBajic –

相关问题