Spaces:
Runtime error
Runtime error
T-K-O-H commited on
Commit ·
9e42f54
1
Parent(s): f4bdf2b
Fix nginx permissions and port configuration
Browse files- Dockerfile +4 -2
- nginx.conf +16 -0
Dockerfile
CHANGED
|
@@ -8,7 +8,9 @@ RUN apt-get update && apt-get install -y \
|
|
| 8 |
nodejs \
|
| 9 |
npm \
|
| 10 |
nginx \
|
| 11 |
-
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
| 12 |
|
| 13 |
# Install Python dependencies
|
| 14 |
COPY backend/requirements.txt .
|
|
@@ -35,7 +37,7 @@ EXPOSE 7860
|
|
| 35 |
|
| 36 |
# Set environment variables
|
| 37 |
ENV PYTHONUNBUFFERED=1
|
| 38 |
-
ENV PORT=
|
| 39 |
ENV REACT_APP_API_URL=https://shipmaster1-pythonicragreact.hf.space
|
| 40 |
|
| 41 |
# Start all services
|
|
|
|
| 8 |
nodejs \
|
| 9 |
npm \
|
| 10 |
nginx \
|
| 11 |
+
&& rm -rf /var/lib/apt/lists/* \
|
| 12 |
+
&& mkdir -p /var/lib/nginx/body \
|
| 13 |
+
&& chown -R www-data:www-data /var/lib/nginx
|
| 14 |
|
| 15 |
# Install Python dependencies
|
| 16 |
COPY backend/requirements.txt .
|
|
|
|
| 37 |
|
| 38 |
# Set environment variables
|
| 39 |
ENV PYTHONUNBUFFERED=1
|
| 40 |
+
ENV PORT=8000
|
| 41 |
ENV REACT_APP_API_URL=https://shipmaster1-pythonicragreact.hf.space
|
| 42 |
|
| 43 |
# Start all services
|
nginx.conf
CHANGED
|
@@ -1,8 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
events {
|
| 2 |
worker_connections 1024;
|
| 3 |
}
|
| 4 |
|
| 5 |
http {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
upstream frontend {
|
| 7 |
server localhost:3000;
|
| 8 |
}
|
|
@@ -22,6 +32,9 @@ http {
|
|
| 22 |
proxy_set_header Connection 'upgrade';
|
| 23 |
proxy_set_header Host $host;
|
| 24 |
proxy_cache_bypass $http_upgrade;
|
|
|
|
|
|
|
|
|
|
| 25 |
}
|
| 26 |
|
| 27 |
location /api/ {
|
|
@@ -31,6 +44,9 @@ http {
|
|
| 31 |
proxy_set_header Connection 'upgrade';
|
| 32 |
proxy_set_header Host $host;
|
| 33 |
proxy_cache_bypass $http_upgrade;
|
|
|
|
|
|
|
|
|
|
| 34 |
}
|
| 35 |
}
|
| 36 |
}
|
|
|
|
| 1 |
+
user www-data;
|
| 2 |
+
worker_processes auto;
|
| 3 |
+
pid /run/nginx.pid;
|
| 4 |
+
|
| 5 |
events {
|
| 6 |
worker_connections 1024;
|
| 7 |
}
|
| 8 |
|
| 9 |
http {
|
| 10 |
+
include /etc/nginx/mime.types;
|
| 11 |
+
default_type application/octet-stream;
|
| 12 |
+
|
| 13 |
+
sendfile on;
|
| 14 |
+
keepalive_timeout 65;
|
| 15 |
+
|
| 16 |
upstream frontend {
|
| 17 |
server localhost:3000;
|
| 18 |
}
|
|
|
|
| 32 |
proxy_set_header Connection 'upgrade';
|
| 33 |
proxy_set_header Host $host;
|
| 34 |
proxy_cache_bypass $http_upgrade;
|
| 35 |
+
proxy_set_header X-Real-IP $remote_addr;
|
| 36 |
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
| 37 |
+
proxy_set_header X-Forwarded-Proto $scheme;
|
| 38 |
}
|
| 39 |
|
| 40 |
location /api/ {
|
|
|
|
| 44 |
proxy_set_header Connection 'upgrade';
|
| 45 |
proxy_set_header Host $host;
|
| 46 |
proxy_cache_bypass $http_upgrade;
|
| 47 |
+
proxy_set_header X-Real-IP $remote_addr;
|
| 48 |
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
| 49 |
+
proxy_set_header X-Forwarded-Proto $scheme;
|
| 50 |
}
|
| 51 |
}
|
| 52 |
}
|