Create nginx.conf
Browse files- nginx.conf +52 -0
nginx.conf
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
server {
|
| 2 |
+
listen 7860 default_server;
|
| 3 |
+
server_name _;
|
| 4 |
+
|
| 5 |
+
client_max_body_size 50M;
|
| 6 |
+
|
| 7 |
+
# Main API endpoints
|
| 8 |
+
location /api/ {
|
| 9 |
+
proxy_pass http://127.0.0.1:3001;
|
| 10 |
+
proxy_http_version 1.1;
|
| 11 |
+
proxy_set_header Upgrade $http_upgrade;
|
| 12 |
+
proxy_set_header Connection 'upgrade';
|
| 13 |
+
proxy_set_header Host $host;
|
| 14 |
+
proxy_set_header X-Real-IP $remote_addr;
|
| 15 |
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
| 16 |
+
proxy_set_header X-Forwarded-Proto $scheme;
|
| 17 |
+
proxy_cache_bypass $http_upgrade;
|
| 18 |
+
proxy_read_timeout 300s;
|
| 19 |
+
proxy_connect_timeout 75s;
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
# Preview endpoints - dynamic port routing
|
| 23 |
+
location ~ ^/preview/([0-9]+)/(.*)$ {
|
| 24 |
+
proxy_pass http://127.0.0.1:$1/$2$is_args$args;
|
| 25 |
+
proxy_http_version 1.1;
|
| 26 |
+
proxy_set_header Upgrade $http_upgrade;
|
| 27 |
+
proxy_set_header Connection 'upgrade';
|
| 28 |
+
proxy_set_header Host $host;
|
| 29 |
+
proxy_set_header X-Real-IP $remote_addr;
|
| 30 |
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
| 31 |
+
proxy_cache_bypass $http_upgrade;
|
| 32 |
+
proxy_read_timeout 300s;
|
| 33 |
+
|
| 34 |
+
# CORS headers for dev server previews
|
| 35 |
+
add_header Access-Control-Allow-Origin * always;
|
| 36 |
+
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS" always;
|
| 37 |
+
add_header Access-Control-Allow-Headers "DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range" always;
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
# Root endpoint
|
| 41 |
+
location / {
|
| 42 |
+
proxy_pass http://127.0.0.1:3001;
|
| 43 |
+
proxy_http_version 1.1;
|
| 44 |
+
proxy_set_header Host $host;
|
| 45 |
+
proxy_set_header X-Real-IP $remote_addr;
|
| 46 |
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
# Access logs
|
| 50 |
+
access_log /var/log/nginx/access.log;
|
| 51 |
+
error_log /var/log/nginx/error.log;
|
| 52 |
+
}
|