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.
http://elastic.ip.address
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/;
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/;
}
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/
.