dor272
dor272

Reputation: 738

nginx proxy_pass doesn't work to localhost

I have my node app running locally on port 3000, I've set up nginx but for some reason it doesn't work right.

I tried to proxy_pass to http://google.com and it worked, but when I change it to http://localhost:3000 I get the nginx error page.

the app is running, i opened port 3000 on my server and I can access it on my http://domain:3000.

 server {
    listen       80;
    listen       [::]:80;
    server_name  mydomain.com;
    # root         /usr/share/nginx/html;

    location / {
            proxy_pass "http://localhost:3000";
    }

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

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

any idea why the proxying doesn't work properly?

Thanks.

Upvotes: 1

Views: 2078

Answers (1)

dor272
dor272

Reputation: 738

This was SELinux issue - blocked http requests.

this command solved it:

setsebool -P httpd_can_network_connect true

Upvotes: 2

Related Questions