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