【问题标题】:CentOS/Nginx server isn't working, hosting Node appsCentOS/Nginx 服务器不工作,托管 Node 应用程序
【发布时间】:2014-07-12 00:53:41
【问题描述】:

我有一个非常简单的服务器设置,但由于某种原因无法正常工作。

我有两个应用程序在本地运行,一个在端口 1999 上,另一个在端口 8000 上。

我已禁用 Apache,并安装了 nginx。这是我在/etc/nginx/ 中的nginx.conf

user  nginx;
worker_processes  8;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include   /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    gzip  on;
    server_names_hash_bucket_size 64;

    include /etc/nginx/conf.d/*.conf;
}

这是我在/etc/nginx/conf.d/ 中的default.conf

server {
    listen 80;

    server_name attendahh.com;

    location / {
        proxy_pass http://localhost:1999;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}

server {
    listen 80;

    server_name threadfinder.net;

    location / {
        proxy_pass http://localhost:8000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}

导航到http://my-ip-address:1999http://my-ip-address:8000 可以正常工作,但转到我的域却不行。

我感觉NGINX 只是普通的不起作用,也许我的主机文件中的某些东西/其他东西把事情搞砸了。关于我可以采取哪些步骤来解决这个问题的任何想法?这是NGINX 的全新安装。

编辑:另外,当我尝试访问 threadfinder.netattendahh.com 时,/var/log/nginx/access.log 的访问日志中没有出现任何内容

【问题讨论】:

    标签: linux apache nginx centos vps


    【解决方案1】:

    嗯,你的 DNS 有问题吗?

    【讨论】:

    • 很有可能,现在调查一下。
    • 名称服务器似乎设置正确,dig @23.226.227.16 attendahh.com 工作(据我所知?)。我可以做任何进一步的测试来看看发生了什么?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-18
    • 2021-04-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-01-19
    相关资源
    最近更新 更多