2012-11-11 99 views
0

我已经安装的Nginx在我的Ubuntu EC2实例和IM建设如何使用Node.js应用程序,当我去我的亚马逊网址即与nginx获取500内部服务器错误?

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/; 
     } 
+0

我认为这是试图调用从Nginx的配置另一个位置,否则Intially叫http://127.0.0.1:8124/,当您尝试访问http://elastic.ip.address/page2它调用http://127.0.0.1:8124//page2“//”是唯一的错误。如果你觉得自己很傻,可能会很无聊 –

回答

0

几件事情要尝试:

  • 看一看/var/log/nginx/error.log,看看你能得到什么地方出了错一些更好的信息。

  • 确保nginx正在运行,因为它具有对/home/ubuntu/project/的读取权限。