R
Railway7mo 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
Percy7mo ago
Project ID: N/A
Brody
Brody7mo ago
do you have a dockerfile?
FerDev
FerDev7mo ago
I have this from the template: FROM nginx:alpine COPY site /usr/share/nginx/html
Brody
Brody7mo ago
you can delete that dockerfile, we wont be needing it
FerDev
FerDev7mo ago
sure
Brody
Brody7mo ago
do you have any build or start commands set in your service settings?
FerDev
FerDev7mo ago
build command from the package.json: "build": "ng build",
Brody
Brody7mo ago
im talking about in the railway service
FerDev
FerDev7mo ago
default option
Brody
Brody7mo ago
do you mean blank?
FerDev
FerDev7mo ago
yep
Brody
Brody7mo ago
in your angular.json, set your 'outputPath to dist
FerDev
FerDev7mo ago
done
Brody
Brody7mo ago
https://github.com/brody192/angular-template copy the nixpacks.toml and Caddyfile from this repo into yours
FerDev
FerDev7mo ago
I've already have an angular app running with caddy, thanks to your help. But I want one running with nginx
Brody
Brody7mo ago
why lol
FerDev
FerDev7mo 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
Brody7mo ago
they are both web servers, both are perfectly capable of running your angular site, and caddy is what i recommend
FerDev
FerDev7mo 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
Brody7mo 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
FerDev7mo 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.