-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnginx.conf
59 lines (49 loc) · 1.89 KB
/
nginx.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#user nobody;
worker_processes 1;
events {
worker_connections 1024; # максимальное количество подключений
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
# отключение информации о сервере
server_tokens off;
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html; # путь к директории dist Vue
index index.html;
# Прокси запросов к /api* на backend
location ^~/api {
proxy_pass http://studposts-back-app:5000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# Перенаправление запросов на /sources* к /api/sources на backend
location ^~/sources {
rewrite ^/sources/(.*)$ /api/sources/$1 break;
proxy_pass http://studposts-back-app:5000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# Перенаправление корневого запроса на /home
location = / {
return 301 /home;
}
# Блок передачи управления навигацией приложению
location / {
try_files $uri $uri/ /index.html;
}
# Обработка статических файлов
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
try_files $uri =404;
expires max;
log_not_found off;
}
}
}