简体   繁体   中英

Ember and Node.js Nginx Configuration amazon EC2 Ubuntu Server

I am getting this error when I try and load my site:

在此处输入图片说明

Reading into it, I think there is an issue with my frontend not being able to contact my backend. I've done a CURL to my backend inside the server and outside and everything works. Also deploying with Ember-Cli-mirage works fine as well, Leading me to believe there is an issue with my NGINX config files. I have two config files one for the front end and one for the backend:

Frontend Ember config:

 server {
 listen 80 default_server;
 listen [::]:80 default_server ipv6only=on;
 root /usr/local/t;
 index index.html;
  location / {
 try_files $uri $uri/ /index.html;
 }
 }

My backend Node.js Express config:

 server {
   listen 80;
   server_name default_server;

    root /usr/local/cloudBackend;
   index index.html index.htm;

   access_log /var/log/nginx/cpe.access.log;
   error_log /var/log/nginx/cpe.error.log notice;

   #  auth_basic "Restricted";
   #  auth_basic_user_file /etc/nginx/.htpasswd;

  location / {
    proxy_pass http://localhost:3001;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Host $host;
    proxy_cache_bypass $http_upgrade;
}
}

Any help would be much appreciated.

将此添加到我的Node.js标头中,然后就可以了!

 res.setHeader('Content-Type', 'application/json');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM