|
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 address. |
| 7 | +2. Configure your DNS provider to point your CODER_SUBDOMAIN and \*.CODER_SUBDOMAIN to your server's public IP address. |
8 | 8 |
|
9 | 9 | > 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 | 10 |
|
|
22 | 22 |
|
23 | 23 | ## Adding Coder deployment subdomain
|
24 | 24 |
|
25 |
| -> This example assumes Coder is running locally on `127.0.0.1:3000` for the subdomain `YOUR_SUBDOMAIN` e.g. `coder.example.com`. |
| 25 | +> This example assumes Coder is running locally on `127.0.0.1:3000` for the subdomain `CODER_SUBDOMAIN` e.g. `coder.example.com`. |
26 | 26 |
|
27 | 27 | 1. Create NGINX configuration for this app:
|
28 | 28 |
|
29 | 29 | ```console
|
30 |
| - sudo touch /etc/nginx/sites-available/YOUR_SUBDOMAIN |
| 30 | + sudo touch /etc/nginx/sites-available/CODER_SUBDOMAIN |
31 | 31 | ```
|
32 | 32 |
|
33 | 33 | 2. Activate this file:
|
34 | 34 |
|
35 | 35 | ```console
|
36 |
| - sudo ln -s /etc/nginx/sites-available/YOUR_SUBDOMAIN /etc/nginx/sites-enabled/YOUR_SUBDOMAIN |
| 36 | + sudo ln -s /etc/nginx/sites-available/CODER_SUBDOMAIN /etc/nginx/sites-enabled/CODER_SUBDOMAIN |
37 | 37 | ```
|
38 | 38 |
|
39 | 39 | ## Install and configure LetsEncrypt Certbot
|
|
52 | 52 | dns_cloudflare_api_token = YOUR_API_TOKEN
|
53 | 53 | ```
|
54 | 54 |
|
| 55 | + ```console |
| 56 | + mkdir -p ~/.secrets/certbot |
| 57 | + touch ~/.secrets/certbot/cloudflare.ini |
| 58 | + vi ~/.secrets/certbot/cloudflare.ini |
| 59 | + ``` |
| 60 | + |
55 | 61 | 3. Set the correct permissions:
|
56 | 62 |
|
57 | 63 | ```console
|
|
71 | 77 | 1. Edit the file with:
|
72 | 78 |
|
73 | 79 | ```console
|
74 |
| - sudo nano /etc/nginx/sites-available/YOUR_SUBDOMAIN |
| 80 | + sudo nano /etc/nginx/sites-available/CODER_SUBDOMAIN |
75 | 81 | ```
|
76 | 82 |
|
77 | 83 | 2. Add the following content:
|
78 | 84 |
|
79 | 85 | ```nginx
|
80 | 86 | server {
|
81 |
| - server_name YOUR_SUBDOMAIN *.YOUR_SUBDOMAIN; |
| 87 | + server_name CODER_SUBDOMAIN *.CODER_SUBDOMAIN; |
82 | 88 |
|
83 | 89 | # HTTP configuration
|
84 | 90 | listen 80;
|
|
92 | 98 | # HTTPS configuration
|
93 | 99 | listen [::]:443 ssl ipv6only=on;
|
94 | 100 | listen 443 ssl;
|
95 |
| - ssl_certificate /etc/letsencrypt/live/YOUR_SUBDOMAIN/fullchain.pem; |
96 |
| - ssl_certificate_key /etc/letsencrypt/live/YOUR_SUBDOMAIN/privkey.pem; |
| 101 | + ssl_certificate /etc/letsencrypt/live/CODER_SUBDOMAIN/fullchain.pem; |
| 102 | + ssl_certificate_key /etc/letsencrypt/live/CODER_SUBDOMAIN/privkey.pem; |
97 | 103 |
|
98 | 104 | location / {
|
99 | 105 | proxy_pass http://127.0.0.1:3000; # Change this to your coder deployment port default is 3000
|
|
110 | 116 | ```
|
111 | 117 |
|
112 | 118 | > Don't forget to change:
|
113 |
| - > `YOUR_SUBDOMAIN` by your (sub)domain e.g. `coder.example.com` |
| 119 | + > `CODER_SUBDOMAIN` by your (sub)domain e.g. `coder.example.com` |
114 | 120 |
|
115 | 121 | 3. Test the configuration:
|
116 | 122 |
|
|
145 | 151 | sudo systemctl restart nginx
|
146 | 152 | ```
|
147 | 153 |
|
148 |
| -And that's it, you should now be able to access Coder at `https://YOUR_SUBDOMAIN`! |
| 154 | +And that's it, you should now be able to access Coder at `https://CODER_SUBDOMAIN` e.g. `https://coder.example.com`. |
0 commit comments