Skip to content

Commit 61822ba

Browse files
committed
Update README with self-contained nginx configuration
- Replace reference to external hornet_services_updated.conf file - Add complete nginx configuration example directly in README - Include WebSocket support, health checks, and all service routing - Remove dependency on external configuration files - Users can now follow setup instructions completely self-contained
1 parent 29bc95e commit 61822ba

1 file changed

Lines changed: 69 additions & 3 deletions

File tree

README.md

Lines changed: 69 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,77 @@ yarn build # Linux/macOS
165165
```
166166

167167
#### Step 2: Configure Nginx
168-
Use the provided configuration as a starting point:
168+
Create an nginx configuration file:
169+
```bash
170+
# Create the configuration file
171+
sudo nano /etc/nginx/sites-available/hornets-relay
172+
```
173+
174+
Add this configuration (adjust domains and paths as needed):
175+
```nginx
176+
# WebSocket connection upgrade mapping
177+
map $http_upgrade $connection_upgrade {
178+
default upgrade;
179+
'' close;
180+
}
181+
182+
server {
183+
listen 80;
184+
server_name your-domain.com; # Replace with your domain
185+
186+
# Forward client IP and protocol
187+
proxy_set_header X-Real-IP $remote_addr;
188+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
189+
proxy_set_header X-Forwarded-Proto $scheme;
190+
191+
# Panel API
192+
location /panel/ {
193+
rewrite ^/panel/(.*)$ /$1 break;
194+
proxy_pass http://127.0.0.1:9002;
195+
}
196+
197+
# Wallet service
198+
location /wallet/ {
199+
rewrite ^/wallet/(.*)$ /$1 break;
200+
proxy_pass http://127.0.0.1:9003;
201+
}
202+
203+
# Frontend React app
204+
location /front/ {
205+
rewrite ^/front/(.*)$ /$1 break;
206+
proxy_pass http://127.0.0.1:3000; # Or serve static files
207+
}
208+
209+
# Default location - Relay service with WebSocket support
210+
location / {
211+
proxy_pass http://127.0.0.1:9001;
212+
213+
# WebSocket headers
214+
proxy_http_version 1.1;
215+
proxy_set_header Upgrade $http_upgrade;
216+
proxy_set_header Connection $connection_upgrade;
217+
proxy_set_header Host $host;
218+
proxy_cache_bypass $http_upgrade;
219+
220+
# Extended timeouts for WebSocket connections
221+
proxy_read_timeout 86400s;
222+
proxy_send_timeout 86400s;
223+
proxy_connect_timeout 60s;
224+
}
225+
226+
# Health check endpoint
227+
location /health {
228+
access_log off;
229+
return 200 "healthy\n";
230+
add_header Content-Type text/plain;
231+
}
232+
}
233+
```
234+
235+
Enable the configuration:
169236
```bash
170-
# Copy the configuration file
171-
sudo cp hornet_services_updated.conf /etc/nginx/sites-available/hornets-relay
172237
sudo ln -s /etc/nginx/sites-available/hornets-relay /etc/nginx/sites-enabled/
238+
sudo nginx -t # Test configuration
173239
```
174240

175241
#### Step 3: Serve Built Files

0 commit comments

Comments
 (0)