首页 > 解决方案 > 如何使用 nginx 和 apache 配置服务器?

问题描述

我已经安装了非常旧的安装了 apache 和 wordpress 的 centOs 服务器。我试图在上面安装 nginx 并遇到了问题: - apache 在端口 80 上工作 - nginx 在端口 81 上这个 nginx 配置,我只是把所有东西都放到一个配置文件中(没有 site_avialialbe)

```

worker_processes  auto;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;

    server {
        listen 81;
        server_name localhost;
        root /usr/share/api;

        location / {
            proxy_pass http://127.0.0.1:3001;
            root /usr/share/api;
            index index.html index.htm;
        }

    }
}

```

我的节点 js 应用程序使用 pm2 并使用本地地址 localhost:3001

当我开始一切,并打电话

wget localhost:3000 它只是返回我 504 错误。

例如,如果我尝试添加一些子域 api.something.com 它会自动将我重定向到带有 wp 网站的主域

我在哪里犯错了?

标签: node.jsnginx

解决方案


已修复,iptables配置有问题,谢谢大家帮忙


推荐阅读