|
2 | 2 |
|
3 | 3 | ## Requirements
|
4 | 4 |
|
5 |
| -1. Start a Coder deployment and be sure to set the following [configuration values](https://coder.com/docs/v2/latest/admin/configure):. |
| 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 CODER_SUBDOMAIN and \*.CODER_SUBDOMAIN to your server's public IP address. |
| 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 |
|
|
22 | 30 |
|
23 | 31 | ## Adding Coder deployment subdomain
|
24 | 32 |
|
25 |
| -> This example assumes Coder is running locally on `127.0.0.1:3000` for the subdomain `CODER_SUBDOMAIN` e.g. `coder.example.com`. |
| 33 | +> This example assumes Coder is running locally on `127.0.0.1:3000` and that you're using `coder.example.com` as your subdomain. |
26 | 34 |
|
27 | 35 | 1. Create NGINX configuration for this app:
|
28 | 36 |
|
29 | 37 | ```console
|
30 |
| - sudo touch /etc/nginx/sites-available/CODER_SUBDOMAIN |
| 38 | + sudo touch /etc/nginx/sites-available/coder.example.com |
31 | 39 | ```
|
32 | 40 |
|
33 | 41 | 2. Activate this file:
|
34 | 42 |
|
35 | 43 | ```console
|
36 |
| - sudo ln -s /etc/nginx/sites-available/CODER_SUBDOMAIN /etc/nginx/sites-enabled/CODER_SUBDOMAIN |
| 44 | + sudo ln -s /etc/nginx/sites-available/coder.example.com /etc/nginx/sites-enabled/coder.example.com |
37 | 45 | ```
|
38 | 46 |
|
39 | 47 | ## Install and configure LetsEncrypt Certbot
|
|
55 | 63 | ```console
|
56 | 64 | mkdir -p ~/.secrets/certbot
|
57 | 65 | touch ~/.secrets/certbot/cloudflare.ini
|
58 |
| - vi ~/.secrets/certbot/cloudflare.ini |
| 66 | + nano ~/.secrets/certbot/cloudflare.ini |
59 | 67 | ```
|
60 | 68 |
|
61 | 69 | 3. Set the correct permissions:
|
|
77 | 85 | 1. Edit the file with:
|
78 | 86 |
|
79 | 87 | ```console
|
80 |
| - sudo nano /etc/nginx/sites-available/CODER_SUBDOMAIN |
| 88 | + sudo nano /etc/nginx/sites-available/coder.example.com |
81 | 89 | ```
|
82 | 90 |
|
83 | 91 | 2. Add the following content:
|
84 | 92 |
|
85 | 93 | ```nginx
|
86 | 94 | server {
|
87 |
| - server_name CODER_SUBDOMAIN *.CODER_SUBDOMAIN; |
| 95 | + server_name coder.example.com *.coder.example.com; |
88 | 96 |
|
89 | 97 | # HTTP configuration
|
90 | 98 | listen 80;
|
|
98 | 106 | # HTTPS configuration
|
99 | 107 | listen [::]:443 ssl ipv6only=on;
|
100 | 108 | listen 443 ssl;
|
101 |
| - ssl_certificate /etc/letsencrypt/live/CODER_SUBDOMAIN/fullchain.pem; |
102 |
| - ssl_certificate_key /etc/letsencrypt/live/CODER_SUBDOMAIN/privkey.pem; |
| 109 | + ssl_certificate /etc/letsencrypt/live/coder.example.com/fullchain.pem; |
| 110 | + ssl_certificate_key /etc/letsencrypt/live/coder.example.com/privkey.pem; |
103 | 111 |
|
104 | 112 | location / {
|
105 | 113 | proxy_pass http://127.0.0.1:3000; # Change this to your coder deployment port default is 3000
|
|
115 | 123 | }
|
116 | 124 | ```
|
117 | 125 |
|
118 |
| - > Don't forget to change: |
119 |
| - > `CODER_SUBDOMAIN` by your (sub)domain e.g. `coder.example.com` |
| 126 | + > Don't forget to change: `coder.example.com` by your (sub)domain |
120 | 127 |
|
121 | 128 | 3. Test the configuration:
|
122 | 129 |
|
|
151 | 158 | sudo systemctl restart nginx
|
152 | 159 | ```
|
153 | 160 |
|
154 |
| -And that's it, you should now be able to access Coder at `https://CODER_SUBDOMAIN` e.g. `https://coder.example.com`. |
| 161 | +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