【问题标题】:Nginx access Denied with nodeJs upstreamNginx 访问被上游 nodeJs 拒绝
【发布时间】:2015-07-13 11:54:00
【问题描述】:

我正在使用 nginx 来上游服务器 nodeJs APP。

我有这个错误:

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"

是的,我们有很多例子要纠正,但没有任何效果......

我已将 nginx.conf 中的用户更改为正在连接的用户:like here

user adminmf

我为我的项目更改了 chmod:775

这是我的会议:

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;
}

如果我使用命令

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

我的服务器正在运行....

但不是:

curl http://ws-test.com

是的,我的 /etc/hosts 中有这一行

127.0.0.1 ws-test.com

我需要帮助!

【问题讨论】:

标签: node.js nginx


【解决方案1】:

如果您在 Fedora linux 上运行,禁用 SElinux 应该可以解决问题。 (谨慎使用)。

要暂时禁用 selinux,请执行sudo setenforce 0

要一次性禁用 selinux,请执行 vim /etc/selinux/configSELINUX=enforcing 更改为 SELINUX=disabled 保存并重新启动

sestatus查看安全增强状态。

【讨论】:

    猜你喜欢
    • 2019-01-28
    • 2019-03-16
    • 1970-01-01
    • 1970-01-01
    • 2021-07-13
    • 2012-03-24
    • 2018-09-13
    • 2021-07-15
    • 2019-02-07
    相关资源
    最近更新 更多