linux - NGINX dns 不适用于 VPS

标签 linux apache nginx dns centos

我对 VPS/Linux 有点陌生,所以请多多包涵。

我有一个域名 (attendahh.com) 指向我主机的名称服务器。

我设置了/etc/nginx/conf.d/attendahh.com.conf 如下:

# the IP(s) on which your node server is running. I chose port 3000.
upstream attendahh.com {
    server 127.0.0.1:1999;
}

# the nginx server instance
server {
    listen 0.0.0.0:80;
    server_name attendahh.com attendahh;
    access_log /var/log/nginx/attendahh.log;

    # pass the request to the node.js server with the correct headers and much $
    location / {
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header Host $http_host;
      proxy_set_header X-NginX-Proxy true;

      proxy_pass http://attendahh.com/;
      proxy_redirect off;
  }
}

然后我service nginx restart

我已经阅读了很多教程和堆栈答案,表面上这就是我需要做的所有事情,但如果我转到 http://attendahh.com它不起作用。

注意事项:

  1. 在浏览器中转到我的 IP + 端口工作正常(23.226.227.16:1999)
  2. 我安装了用于 VPS 的 Cpanel(我最初尝试在那里设置 DNS,但它没有用,我已经从那里删除了 dns 条目,但它可能仍然会影响事情)
  3. Apache 虚拟主机httpd.config 中被注释掉了。

关于我在这里做错了什么有什么想法吗?也许 apachenginx 之间存在一些冲突?

最佳答案

-       proxy_pass http://attendahh.com/;
+       proxy_pass http://attendahh.com;

关于linux - NGINX dns 不适用于 VPS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24688744/

相关文章:

c - setpgid 的竞争条件

ruby-on-rails - websocket 握手期间的 Rails ActionCable 错误

elasticsearch - 如何将 tcp 重定向到 nginx 中 Elasticsearch 服务器的端口 9300?

apache - 如果不存在图像则显示默认图像

css 无法在 apache 后面的 glassfish(bootsfaces primefaces)上运行 jsf 应用程序

docker - docker build在 “permission denied”上失败并显示 `nginx -t`

python - 使用 optparse 调用函数

c++ - Visual Studio : Intellisense Problems and Linux Compatibility

linux - Sox:混合两个输入,其中一个重复

apache - HTACCESS - 排除某些域