maz
Phoenix as simple webserver
We are making a web site which will be static content at first, but would require content updates of course. Essentially a marketing page. So I don’t foresee templating nor routes being required in the near future. Someday it’s possible that we’d need a webapp though so is it possible to have Phoenix serve pages like a very simple web server? Or would it be better just to make a simple elixir app that has Cowboy as a dependency instead for now? Can my colleague simply drop files in the right spot and no need to maintain any sort of cache?
First Post!
adrianrl
I’d say go for a static website generator (Gatsby, Jekyll, Next.js, Nuxt.js…), in other words, take a look to the JAMstack. Very simple, you just have to write HTML, CSS, JavaScript and Markdown, and if at some point you need something more dynamic, just create an API in Phoenix and fetch the data from your app.
Most Liked
maz
So I finally settled on using nginx to serve static files. Cowboy with Plug is powerful but is serious overkill for a static site, from some investigation. I used:
https://github.com/alfredfrancis/minimal-nginx-web-server-docker
and tweaked the docker-compose.yml to suit my purposes:
version: '3'
services:
nginx:
build: image/
ports:
- "8080:80"
volumes:
- ./www/:/www-data/
restart: always
labels:
- "traefik.frontend.rule=Host:****.app"
- "traefik.frontend.entryPoints=http,https"
networks:
default:
external:
name: web
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex









