polypush135
Mix phx.gen.cert for wildcard certs
I’m creating a white label site for elixir user groups.
https://github.com/PDX-Elixir-Group/elixir.group
One of the main ideas is that I want to subdomain each user group. ie: I own elixir.group and I want to setup a group as pdx.elixir.group
I’ve been able to successfully setup self signed certs for just a single domain locally via mix phx.gen.cert which fyi is awesome ! but I’m having a hard time trying to get a wildcard cert working. Any pointers?
Has anyone else been able to successfully do this locally?
Most Liked
voltone
It works for me:
$ mix phx.new wildcard --no-ecto --no-webpack
* creating wildcard/config/config.exs
* creating wildcard/config/dev.exs
[...snip...]
$ cd wildcard
$ mix phx.gen.cert localhost "*.localhost"
* creating priv/cert/selfsigned_key.pem
* creating priv/cert/selfsigned.pem
[..snip...]
$ vim config/dev.exs
# Edit as instructed
$ sudo vim /etc/hosts
# Add localhost subdomain
$ head -1 /etc/hosts
127.0.0.1 localhost localhost.localdomain test.localhost
$ iex -S mix phx.server
Erlang/OTP 21 [erts-10.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe]
[info] Running NewV140Web.Endpoint with cowboy 2.6.0 at https://localhost:4001
[info] Running NewV140Web.Endpoint with cowboy 2.6.0 at https://localhost:4001
Interactive Elixir (1.7.3) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)>
Opening https://localhost:4001/ and https://test.localhost:4001/ works in both Chrome and Firefox. Of course I need to confirm trusting the self-signed cert, but that’s expected.
Can you please clarify what’s not working for you?
Last Post!
polypush135
As you can see in my later screen shot I’ve already approved the certs and have set the flag in chrome. I have also tried this in other browsers too with no luck.
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









