【问题标题】:getting a 500 internl server error with nginx?使用 nginx 收到 500 内部服务器错误?
【发布时间】:2012-11-12 00:39:47
【问题描述】:

我已经在我的 ubuntu ec2 实例上安装了 nginx,并正在使用 node.js 构建一个应用程序,当我访问我的亚马逊网址时,即

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

【问题讨论】:

标签: node.js nginx amazon-ec2 amazon-web-services


【解决方案1】:

有几件事可以尝试:

  • 查看/var/log/nginx/error.log,看看您是否能获得有关问题所在的更好信息。

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

【讨论】:

    猜你喜欢
    • 2015-03-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-06-11
    • 1970-01-01
    • 1970-01-01
    • 2014-08-27
    • 1970-01-01
    相关资源
    最近更新 更多