Reputation: 611
I have a Rails 5 API fully separate with capistrano. I have a ubuntu droplet on Digital Ocean and its running Rails 5 API deployed with capistrano, nginx, passenger phussion, postgresql.
I have a separate Angular front static website which will be dropped in AWS s3. Due to latency issue and pricing, I want both app front and back end on same droplet. Is it possible? If yes how to do that?
Upvotes: 1
Views: 473
Reputation: 1290
You can set a second server block on nginx to your Angular project.
Copy and edit the default configuration file in /etc/nginx/sites-available/default
,
sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-available/angular_project
Point it to the folder containing your front end and set your domain name:
server {
...
root angular/project/path;
server_name frontend.domain.name.com;
...
}
Then enable the server block:
sudo ln -s /etc/nginx/sites-available/angular_project /etc/nginx/sites-enabled/
And restart the ngingx service
sudo service nginx restart
Upvotes: 1