Skip to content

Commit 94fc204

Browse files
author
Jeff Schroeder
committed
Update blockdaemon nginx config
When starting nginx with the standalone-dev-nginx.conf, with the previous values in the blockdaemon config, nginx errors out with an error such as: 2021/09/16 11:52:29 [emerg] 126854#0: host not found in upstream "YOUR_SERVER-solana-01.bdnodes.net" in blockdaemon-virt-server-config.conf:64 Setting it to a variable delays the name resolution until a request is made. This makes it much easier to get a test nginx proxy up and running.
1 parent c0eaadd commit 94fc204

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

doc/nginx-configs/blockdaemon-virt-server-config.conf

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,34 @@ server {
1616
try_files /nonexistent-used-for-try-testing @$http_upgrade;
1717
}
1818

19+
# These need to be manually edited to your specific config.
20+
set $upstream_host YOUR_SERVER;
21+
set $auth_token REPLACE_ME_WITH_YOUR_AUTH_TOKEN;
22+
1923
location @websocket {
2024
# Cheat a little to make sure we don't have a trailing slash on the
2125
# path or we get a 405 response (method not allowed)
22-
proxy_pass https://YOUR_SERVER-solana-01.bdnodes.net/$http_upgrade;
26+
proxy_pass https://$upstream_host/$http_upgrade;
2327
proxy_http_version 1.1;
2428
proxy_set_header Host $proxy_host;
2529
# websocket requirements
2630
proxy_set_header Upgrade $http_upgrade;
2731
proxy_set_header Connection "Upgrade";
2832
# Blockdaemon specific authentication requirement
29-
proxy_set_header Authorization "Bearer REPLACE_ME_WITH_YOUR_AUTH_TOKEN";
33+
proxy_set_header Authorization "Bearer $auth_token";
3034
proxy_redirect https://$proxy_host http://$server_name:$server_port;
3135
proxy_redirect https:// http://;
3236
}
3337

3438
location @ {
35-
proxy_pass https://YOUR_SERVER-solana-01.bdnodes.net$request_uri;
39+
# Example: companyname-solana-09.bdnodes.net
40+
proxy_pass https://$upstream_host$request_uri;
3641
proxy_http_version 1.1;
3742
proxy_set_header Host $proxy_host;
3843
# HTTP v.1.1 keepalive requirements
3944
proxy_set_header Connection "";
4045
# Blockdaemon specific authentication requirement
41-
proxy_set_header Authorization "Bearer REPLACE_ME_WITH_YOUR_AUTH_TOKEN";
46+
proxy_set_header Authorization "Bearer $auth_token";
4247
proxy_redirect https://$proxy_host http://$server_name:$server_port;
4348
proxy_redirect https:// http://;
4449
}
@@ -53,15 +58,18 @@ server {
5358
server {
5459
listen 7800;
5560

61+
set $upstream_host YOUR_SERVER;
62+
set $auth_token REPLACE_ME_WITH_YOUR_AUTH_TOKEN;
63+
5664
location / {
57-
proxy_pass https://YOUR_SERVER-solana-01.bdnodes.net/websocket;
65+
proxy_pass https://$upstream_host/websocket;
5866
proxy_http_version 1.1;
5967
proxy_set_header Host $proxy_host;
6068
# websocket requirements
6169
proxy_set_header Upgrade $http_upgrade;
6270
proxy_set_header Connection "Upgrade";
6371
# Blockdaemon specific authentication requirement
64-
proxy_set_header Authorization "Bearer REPLACE_ME_WITH_YOUR_AUTH_TOKEN";
72+
proxy_set_header Authorization "Bearer $auth_token";
6573
proxy_redirect https://$proxy_host http://$server_name:$server_port;
6674
proxy_redirect https:// http://;
6775
}

0 commit comments

Comments
 (0)