1

I have a redhat Ec2 instance. And I have a simple Express App running on port 3000. I installed nginx and it is running correctly because I am able to proxy s3 buckets static sites to other subdomains I am using. However, when I try and proxy my Express app to one of my subdomains I keep getting the nginx failure page. Here is my nginx config block I am using:

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 {
    }
}
8
  • 1
    are node and nginx running on the same instance? Commented Jun 5, 2017 at 18:41
  • Yes they are running on the same instance. My node app is running in /opt/api Commented Jun 5, 2017 at 19:14
  • you should then try using proxy_pass http://127.0.0.1:3000; Commented Jun 5, 2017 at 19:16
  • proxy_pass 127.0.0.1:3000; did not work Commented Jun 5, 2017 at 20:02
  • Are there any .conf files in /etc/nginx/default.d/? Commented Jun 5, 2017 at 20:17

1 Answer 1

1

Thanks to @DusanBajic the answer is sudo setenforce 0

Sign up to request clarification or add additional context in comments.

1 Comment

keep in mind that this fix will not survive a reboot, you need to disable selinux permanently (fedora, centos)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.