Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nginx access Denied with nodeJs upstream

Tags:

node.js

nginx

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 !

like image 755
Jimmy Avatar asked Nov 27 '25 23:11

Jimmy


1 Answers

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.

like image 127
Robin XW Avatar answered Dec 01 '25 00:12

Robin XW