3

I'm using nginx to upstream a server nodeJs APP.

I have this error :

2015/05/04 08:41:46 [crit] 5355#0: *7 connect() to 127.0.0.1:2000 failed (13: Permission denied) while connecting to upstream, client: 127.0.0.1, server: ws-test.com, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:2000/", host: "ws-test.com"

Yes we have a lot of example to correct but nothing working...

I have change the user in nginx.conf to the conecting user: like here

user adminmf

I have change chmod for my project : 775

This is my conf :

upstream proxy {
    # Correspond au serveur proxy que vous avez lancé avec npm run startProxy
    server localhost:2000;
}

server {
    listen 80;
    server_name ws-test.com;

    location / {
        proxy_pass http://proxy;
    }

    error_log  /var/log/nginx/proxyWS.error.log;
    access_log  /var/log/nginx/proxyWS.access.log;
}

If I use the commande

curl http://localhost:2000/
curl http://127.0.0.1:2000/

My server is working....

But not with :

curl http://ws-test.com

Yes I have this line in my /etc/hosts

127.0.0.1 ws-test.com

I need help !

Community
  • 1
  • 1
Jimmy
  • 41
  • 3
  • Because http://ws-test.com means http://ws-test.com:80 , where your server isn't listening. – namezero May 04 '15 at 07:16
  • My server is listening on port 80 : listen 80; If I use curl http://ws-test.com:80/ the problem is the same – Jimmy May 05 '15 at 09:28
  • Nothing else ? Nobady has the correction ? It's already not working .... – Jimmy May 28 '15 at 07:00
  • 1
    I solved my issue here : http://stackoverflow.com/questions/23948527/13-permission-denied-while-connecting-to-upstreamnginx The second answer – Jimmy May 28 '15 at 12:19

1 Answers1

3

If you are running on Fedora linux, disable SElinux should do the trick. (use carefully).

To temporarily disable selinux, do sudo setenforce 0

To disable selinux once for all, do vim /etc/selinux/config Change SELINUX=enforcing to SELINUX=disabled save and reboot

sestatusto check the security enhancement status.

Robin XW
  • 71
  • 6