|
2 | 2 |
|
3 | 3 | ## Requirements
|
4 | 4 |
|
5 |
| -1. Start a Coder deployment with a wildcard subdomain. See [this guide](https://coder.com/docs/v2/latest/admin/configure#wildcard-access-url) for more information. |
| 5 | +1. Start a Coder deployment and be sure to set the following [configuration values](https://coder.com/docs/v2/latest/admin/configure): |
6 | 6 |
|
7 |
| -2. Configure your DNS provider to point your YOUR_SUBDOMAIN and \*.YOUR_SUBDOMAIN to your server's public ip. |
| 7 | + ```console |
| 8 | + CODER_HTTP_ADDRESS=127.0.0.1:3000 |
| 9 | + CODER_ACCESS_URL=https://coder.example.com |
| 10 | + CODER_WILDCARD_ACCESS_URL=*coder.example.com |
| 11 | + ``` |
| 12 | + |
| 13 | + Throughout the guide, be sure to replace `coder.example.com` with the domain you intend to use with Coder. |
| 14 | + |
| 15 | +2. Configure your DNS provider to point your coder.example.com and \*.coder.example.com to your server's public IP address. |
8 | 16 |
|
9 | 17 | > For example, to use `coder.example.com` as your subdomain, configure `coder.example.com` and `*.coder.example.com` to point to your server's public ip. This can be done by adding A records in your DNS provider's dashboard.
|
10 | 18 |
|
|
32 | 40 |
|
33 | 41 | ## Install and configure LetsEncrypt Certbot
|
34 | 42 |
|
35 |
| -1. Install LetsEncrypt Certbot: Refer to the [CertBot documentation](https://certbot.eff.org/instructions?ws=other&os=pip&tab=wildcard) |
| 43 | +1. Install LetsEncrypt Certbot: Refer to the [CertBot documentation](https://certbot.eff.org/instructions?ws=apache&os=ubuntufocal&tab=wildcard). Be sure to pick the wildcard tab and select your DNS provider for instructions to install the necessary DNS plugin. |
36 | 44 |
|
37 | 45 | ## Create DNS provider credentials
|
38 | 46 |
|
|
46 | 54 | dns_cloudflare_api_token = YOUR_API_TOKEN
|
47 | 55 | ```
|
48 | 56 |
|
| 57 | + ```console |
| 58 | + mkdir -p ~/.secrets/certbot |
| 59 | + touch ~/.secrets/certbot/cloudflare.ini |
| 60 | + nano ~/.secrets/certbot/cloudflare.ini |
| 61 | + ``` |
| 62 | + |
49 | 63 | 3. Set the correct permissions:
|
50 | 64 |
|
51 | 65 | ```console
|
|
62 | 76 |
|
63 | 77 | ## Configure Apache
|
64 | 78 |
|
65 |
| -> This example assumes Coder is running locally on `127.0.0.1:3000` for the subdomain `YOUR_SUBDOMAIN` e.g. `coder.example.com`. |
| 79 | +> This example assumes Coder is running locally on `127.0.0.1:3000` and that you're using `coder.example.com` as your subdomain. |
66 | 80 |
|
67 | 81 | 1. Create Apache configuration for Coder:
|
68 | 82 |
|
|
74 | 88 |
|
75 | 89 | ```apache
|
76 | 90 | <VirtualHost *:443>
|
77 |
| - ServerName dev.dietstyler.com |
78 |
| - ServerAlias *.dev.dietstyler.com |
| 91 | + ServerName coder.example.com |
| 92 | + ServerAlias *.coder.example.com |
79 | 93 | ErrorLog ${APACHE_LOG_DIR}/error.log
|
80 | 94 | CustomLog ${APACHE_LOG_DIR}/access.log combined
|
81 | 95 |
|
|
89 | 103 | RewriteCond %{HTTP:Upgrade} websocket [NC]
|
90 | 104 | RewriteRule /(.*) ws://127.0.0.1:3000/$1 [P,L]
|
91 | 105 |
|
92 |
| - SSLCertificateFile /etc/letsencrypt/live/dev.dietstyler.com/fullchain.pem |
93 |
| - SSLCertificateKeyFile /etc/letsencrypt/live/dev.dietstyler.com/privkey.pem |
| 106 | + SSLCertificateFile /etc/letsencrypt/live/coder.example.com/fullchain.pem |
| 107 | + SSLCertificateKeyFile /etc/letsencrypt/live/coder.example.com/privkey.pem |
94 | 108 | </VirtualHost>
|
95 | 109 | ```
|
96 | 110 |
|
97 |
| - > Don't forget to change: |
98 |
| - > `YOUR_SUBDOMAIN` by your (sub)domain e.g. `coder.example.com` |
| 111 | + > Don't forget to change: `coder.example.com` by your (sub)domain |
99 | 112 |
|
100 | 113 | 3. Enable the site:
|
101 | 114 |
|
|
130 | 143 | sudo certbot renew -q
|
131 | 144 | ```
|
132 | 145 |
|
133 |
| -And that's it, you should now be able to access Coder at `https://YOUR_SUBDOMAIN`! |
| 146 | +And that's it, you should now be able to access Coder at your sub(domain) e.g. `https://coder.example.com`. |
0 commit comments