我对 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它不起作用。
注意事项:
- 在浏览器中转到我的 IP + 端口工作正常(
23.226.227.16:1999
) - 我安装了用于 VPS 的 Cpanel(我最初尝试在那里设置 DNS,但它没有用,我已经从那里删除了 dns 条目,但它可能仍然会影响事情)
- Apache
虚拟主机
在httpd.config
中被注释掉了。
关于我在这里做错了什么有什么想法吗?也许 apache
和 nginx
之间存在一些冲突?
最佳答案
- proxy_pass http://attendahh.com/;
+ proxy_pass http://attendahh.com;
关于linux - NGINX dns 不适用于 VPS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24688744/