Node.js 使用nginx获取500 internl服务器错误?

Node.js 使用nginx获取500 internl服务器错误?,node.js,nginx,amazon-ec2,amazon-web-services,Node.js,Nginx,Amazon Ec2,Amazon Web Services,我已经在我的ubuntu ec2实例上安装了nginx,我正在使用node.js构建一个应用程序,当我转到我的amazon url时,即 http://elastic.ip.address 它工作正常,因此运行/文件: app.get('/', function(req, res) { return res.render('home'); }); 但是,当我尝试转到http://elastic.ip.address/page2: app.get('/page2', fun

我已经在我的ubuntu ec2实例上安装了nginx,我正在使用node.js构建一个应用程序,当我转到我的amazon url时,即

http://elastic.ip.address
它工作正常,因此运行/文件:

app.get('/', function(req, res) {
    return res.render('home');
  });
但是,当我尝试转到
http://elastic.ip.address/page2:

    app.get('/page2', function(req, res) {
    return res.render('page2');

  });
我得到了500内部服务器错误,所以我真的不知道发生了什么,这在我的本地主机上运行,而不运行nginx,但不运行我的ec2

这是我的nginx配置文件布局:

server {
        listen   80;

        root /home/ubuntu/project/;



        server_name  static_ip.compute-1.amazonaws.com;


        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to index.html
                try_files $uri $uri/ /index.html;
                # Uncomment to enable naxsi on this location
                # include /etc/nginx/naxsi.rules
                proxy_pass      http://127.0.0.1:8124/;
        }

有两件事可以尝试:

  • 查看一下
    /var/log/nginx/error.log
    ,看看您是否可以获得关于出错原因的更好信息

  • 确保运行nginx的用户具有对
    /home/ubuntu/project/
    的读取权限


我认为它试图从Nginx config调用另一个位置,否则它最初调用时,当您尝试调用它时,调用“/”是唯一的错误。可能是愚蠢的,如果你觉得愚蠢,就忽略它