Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

getting a 500 internl server error with nginx?

getting a 500 internl server error with nginx?


i have installed Nginx on my ubuntu ec2 instance and im building an app using node.js, and when i go my amazon url i.e.


it works fine, so its running the / file:

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

however when i try go to http://elastic.ip.address/page2:

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


I get the 500 internal Server Error, so i really don't know whats happening, this works on my localhost without running nginx, but not my ec2.

this is my nginx configuration file layout:

server {
        listen   80;

        root /home/ubuntu/project/;


        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
Problem courtesy of: unknown


A couple things to try:

  • Have a look at /var/log/nginx/error.log and see if you can get some better information about what's going wrong.

  • Make sure that the user that nginx is running as has read permissions to /home/ubuntu/project/.

Solution courtesy of: platforms


View additional discussion.

This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

getting a 500 internl server error with nginx?


Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription