R
Railway13mo ago
FerDev

How to deploy an angular app using nginx as web server without starting from template

Already I have an angular app, I want to deploy it as a service project that use nginx as web server, but I really know absolutely nothing of how to do it. The app is an really basic small angular 15 app, it has angular routing.
21 Replies
Percy
Percy13mo ago
Project ID: N/A
Brody
Brody13mo ago
do you have a dockerfile?
FerDev
FerDev13mo ago
I have this from the template: FROM nginx:alpine COPY site /usr/share/nginx/html
Brody
Brody13mo ago
you can delete that dockerfile, we wont be needing it
FerDev
FerDev13mo ago
sure
Brody
Brody13mo ago
do you have any build or start commands set in your service settings?
FerDev
FerDev13mo ago
build command from the package.json: "build": "ng build",
Brody
Brody13mo ago
im talking about in the railway service
FerDev
FerDev13mo ago
default option
Brody
Brody13mo ago
do you mean blank?
FerDev
FerDev13mo ago
yep
Brody
Brody13mo ago
in your angular.json, set your 'outputPath to dist
FerDev
FerDev13mo ago
done
Brody
Brody13mo ago
https://github.com/brody192/angular-template copy the nixpacks.toml and Caddyfile from this repo into yours
FerDev
FerDev13mo ago
I've already have an angular app running with caddy, thanks to your help. But I want one running with nginx
Brody
Brody13mo ago
why lol
FerDev
FerDev13mo ago
I was reading about web servers, from that i understood that nginx is a popular and efficient web server. So i try to run my app with nginx that i think is different from Caddy... or not?
Brody
Brody13mo ago
they are both web servers, both are perfectly capable of running your angular site, and caddy is what i recommend
FerDev
FerDev13mo ago
and I saw why, my angular app runs wery well in a caddy server made with your guide. But i want to test and compare it with an running on nginx
Brody
Brody13mo ago
I'll be honest, I don't see much of a point in doing that personally I'm here to provide support to get your app running on Railway, I do think I have done that
FerDev
FerDev13mo ago
Ok, I respect that and I won't continue the thread. At some point Caddy seemed like a good web server for x reason, although I saw that the application works quite well with that server, I like to try various options and form my own criteria based on several factors. Without anything else to add, I appreciate your help to the community, I am impressed by your omnipresence. Thank you.
Want results from more Discord servers?
Add your server