Skip to content

Commit b51bafb

Browse files
committed
Add nginx service to docker-compose.yml and Dockerfile for linux
1 parent 9caa8e3 commit b51bafb

File tree

4 files changed

+92
-1
lines changed

4 files changed

+92
-1
lines changed

installation/linux/docker-compose.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,14 @@ services:
4949
- "3000:3000"
5050
depends_on:
5151
backend:
52-
condition: service_healthy
52+
condition: service_healthy
53+
nginx:
54+
build: ./nginx
55+
volumes:
56+
- ./backend/static:/static
57+
- ./nginx/:/etc/nginx/conf.d/:ro
58+
- ./certbot/www/:/var/www/certbot/:ro
59+
- ./certbot/www/:/etc/nginx/ssl/:ro
60+
ports:
61+
- "80:80"
62+
- "443:443"

installation/linux/nginx/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM nginx:1.21.6
2+
3+
COPY ./default.conf /etc/nginx/conf.d/default.conf

installation/linux/nginx/default.conf

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
upstream django {
2+
server llm_api:8001;
3+
}
4+
5+
server {
6+
listen 80;
7+
server_name YOUR_IP_ADDRESS;
8+
# server_name 10.300.60.200; - for example
9+
keepalive_timeout 10000;
10+
proxy_read_timeout 10000;
11+
proxy_connect_timeout 10000;
12+
proxy_send_timeout 10000;
13+
client_max_body_size 100M;
14+
15+
location / {
16+
proxy_pass http://django;
17+
}
18+
19+
location /static/ {
20+
alias /static/;
21+
}
22+
}

installation/linux/nginx/temp.conf

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
upstream django {
2+
server backend:8000;
3+
}
4+
5+
server {
6+
listen 80;
7+
listen [::]:80;
8+
9+
server_name svlpmygptbknd01.stjude.org www.svlpmygptbknd01.stjude.org;
10+
server_tokens off;
11+
12+
# location / {
13+
# proxy_pass http://django;
14+
# }
15+
16+
location / {
17+
proxy_pass http://backend;
18+
return 301 http://svlpmygptbknd01.stjude.org$request_uri;
19+
}
20+
21+
location /static/ {
22+
alias /static/;
23+
}
24+
25+
location /.well-known/acme-challenge/ {
26+
root /var/www/certbot;
27+
}
28+
}
29+
30+
server {
31+
listen 443 default_server ssl http2;
32+
listen [::]:443 ssl http2;
33+
34+
ssl on;
35+
36+
server_name svlpmygptbknd01.stjude.org;
37+
38+
ssl_certificate /etc/nginx/ssl/svlpmygptbknd01.pem;
39+
ssl_certificate_key /etc/nginx/ssl/svlpmygptbknd01.pem;
40+
41+
location / {
42+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
43+
proxy_set_header X-Forwarded-Proto https;
44+
proxy_set_header Host $http_host;
45+
proxy_redirect off;
46+
47+
if (!-f $request_filename) {
48+
proxy_pass http://backend;
49+
break;
50+
}
51+
}
52+
53+
location /static/ {
54+
alias /static/;
55+
}
56+
}

0 commit comments

Comments
 (0)