Reputation: 3149
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/my-api-domain.com/public_html/
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:
I then ran ember build -prod
locally and uploaded the contents of the resulting dist
folder to:
/var/www/my-ember-domain.com/public_html/
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://159.203.31.72/ember in the browser, I get an nginx 502 Bad Gateway
. How can I serve my Ember app?
Upvotes: 0
Views: 820
Reputation: 6338
ember server
starts a development server which should not be used in production. Build your app using ember build --prod
. Afterwards you will find your assets in dist/
folder. Serve that ones with nginx and you are done. There is an example nginx.conf
in ember-cli docs: https://ember-cli.com/user-guide/#deploying-an-https-server-using-nginx-on-a-unixlinuxmacosx-machine
You could use ember-cli-deploy if you have to set up a more complex deployment workflow.
Upvotes: 1