A simple application that serves multiple hostnames over HTTPS using self-signed certificates.
-
Add Local Domains
Add the following entries to your
/etc/hosts
file:127.0.0.1 domain1.localhost domain2.localhost
-
Generate SSL Certificates
Run the certificate generation script:
chmod +x generate_certs.sh ./generate_certs.sh
This will create self-signed certificates in
priv/certs/
for:- domain1.localhost
- domain2.localhost
-
Start the App
rebar3 shell
The cowboy will start with:
- HTTP on port 8080 (redirects to HTTPS)
- HTTPS on port 8443
Visit the following URLs in your browser:
- http://domain1.localhost:8080
- http://domain2.localhost:8080
- https://domain1.localhost:8443
- https://domain2.localhost:8443
Note: Since we're using self-signed certificates, your browser will show a security warning. You can:
- Click "Advanced" and proceed anyway (temporary)
- Add the certificates to your system's trusted certificates (permanent)