简体   繁体   English

无法通过Web浏览器访问我的nodejs服务器

[英]Can't get to my nodejs server through web browser

Alright, so I setup a node.js server quite a while ago on a AWS EC2 micro server. 好吧,所以我在不久前在AWS EC2微服务器上设置了node.js服务器。 I was completely new to it and followed various tutorials to get it up and running. 我对它是全新的,并遵循各种教程来启动和运行。 It used nginx as a reverse proxy (I believe) and the server was listening on port 8124. 它使用nginx作为反向代理(我相信),服务器正在侦听端口8124。

Now, the instance got restarted and I can't for the life of me get access to my server back. 现在,实例重新启动,我无法终身访问我的服务器。 I can ssh to it. 我可以ssh到它。 I can start the server. 我可以启动服务器了。 I can send POST/PUT requests to it through my local command line, but my web browser gives me the 404 nginx page. 我可以通过我的本地命令行向它发送POST / PUT请求,但我的Web浏览器给了我404 nginx页面。

This is driving me up the wall - where in the browser/nginx/nodejs chain are things breaking down? 这推动了我的问题 - 在浏览器/ nginx / nodejs链中发生了什么事情?

Please help - I'm horribly new at this at it must be a single line somewhere that's broken. 请帮助 - 我在这方面非常新,因为它必须是一条破坏的地方。 I just don't know enough to find it. 我只是不知道找到它。

My /etc/nginx/sites-enables/default file simply contains 我的/ etc / nginx / sites-enable / default文件只包含

location / {
    proxy_pass      http://127.0.0.1:8124/;
}

Okay I figured it out. 好吧我明白了。 I had to go directly into /etc/nginx/nginx.conf and in the server that was there 我必须直接进入/etc/nginx/nginx.conf并在那里的服务器中

location / {
        root   /usr/share/nginx/html;
        index  index.html index.htm;
    }

I added the line 我添加了这条线

            proxy_pass http://127.0.0.1:8124/;

Oh thank god. 哦,谢天谢地。 That was going to kill me. 这会杀了我。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM