Skip to content

Commit 61bd8ab

Browse files
authored
added example nginx config (#108)
1 parent dd944a4 commit 61bd8ab

File tree

1 file changed

+50
-1
lines changed

1 file changed

+50
-1
lines changed

documentation/configuration.md

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,53 @@ Once all three services are running, set up Headscale and Headscale UI _by creat
8181
location /web/ {
8282
proxy_pass https://XXX.XXX.XXX.XXXX:port/web/;
8383
}
84-
```
84+
```
85+
86+
# Nginx Example Configuration
87+
From https://github.com/gurucomputing/headscale-ui/issues/71
88+
89+
```
90+
map $http_upgrade $connection_upgrade {
91+
default keep-alive;
92+
'websocket' upgrade;
93+
'' close;
94+
}
95+
96+
server {
97+
server_name headscale-01.example.com;
98+
99+
location /web {
100+
alias /usr/local/www/headscale-ui;
101+
index index.html;
102+
}
103+
104+
location / {
105+
proxy_pass http://localhost:8080;
106+
proxy_http_version 1.1;
107+
proxy_set_header Upgrade $http_upgrade;
108+
proxy_set_header Connection $connection_upgrade;
109+
proxy_set_header Host $server_name;
110+
proxy_redirect http:// https://;
111+
proxy_buffering off;
112+
proxy_set_header X-Real-IP $remote_addr;
113+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
114+
proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
115+
add_header Strict-Transport-Security "max-age=15552000; includeSubDomains" always;
116+
}
117+
118+
listen 443 ssl;
119+
ssl_certificate fullchain.pem;
120+
ssl_certificate_key privkey.pem;
121+
[...]
122+
}
123+
124+
server {
125+
if ($host = headscale-01.example.com) {
126+
return 301 https://$host$request_uri;
127+
}
128+
129+
server_name headscale-01.example.com;
130+
listen 80;
131+
return 404;
132+
}
133+
```

0 commit comments

Comments
 (0)