mardi 16 mai 2017

How can I deploy an Ember app on Digital Ocean?

I have an Ember app running on port 4200 that uses an Express API on port 4500. I have uploaded my API to:

/var/www/http://ift.tt/2qsJR95

I have also edited the nginx sites-available file:

location /
{
    proxy_pass http://localhost:4500;
    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;
}

I SSH into the server, change directory to my API, and run node server and this works! When I visit my IP in the browser, I see my API working properly:

http://159.203.31.72

I then ran ember build -prod locally and uploaded the contents of the resulting dist folder to:

/var/www/http://ift.tt/2pGTNP7

I once again updated the nginx sites-available with:

location /ember
{
    proxy_pass http://localhost:4200;
    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;
}

Now what? Typically, when I run the site locally, I'd run ember server, but the resulting files in dist look much different and I don't have ember cli installed on the server. As I read about it, that doesn't seem to be the proper approach.

When I hit http://ift.tt/2qsNBYo in the browser, I get an nginx 502 Bad Gateway. How can I serve my Ember app?




Aucun commentaire:

Enregistrer un commentaire