Wait, really? I use NPM and also have two sites running via a separate nginx container – i feel so dumb now LMAO
Comment on Best way to dockerize a static website?
lemmyvore@feddit.nl 11 months ago
I see from your other comments that you’re already running nginx in other containers. The simplest solution would be to make use of one of them. Zero overhead since you’re not adding any new container. 🙂
You mentioned you’re using NPM, well NPM already has a built-in nginx host that you can reach by making a proxy host pointed at 127.0.0.1:80 and adding the following to the “Advanced” tab:
location / { root /data/nginx/local_static; index index.html; }
Replace the root location with whatever dir you want, use a volume option on the NPM container to map the dir to the host, put your files in there and that’s it.
jivandabeast@lemmy.browntown.dev 11 months ago
lemmyvore@feddit.nl 11 months ago
Yeah it’s not exactly an obvious feature. I don’t even remember how I stumbled onto it, I think I was looking at the /data dirs and noticed the default one.
I haven’t tried using it for more than one site but I think that if you add multiple domain names to the same proxy host they go to the same server instance and you might be able to tweak the “Advanced” config to serve all of them as virtual hosts.
shnizmuffin@lemmy.inbutts.lol 11 months ago
Clarity:
NPM (Nginx Proxy Manager) != npm (node package manager).