45 lines
1.2 KiB
Nginx Configuration File
45 lines
1.2 KiB
Nginx Configuration File
server {
|
|
listen 80;
|
|
server_name _;
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
# Важно: /api выше location / иначе try_files отдаст index.html
|
|
location /api/ {
|
|
proxy_pass http://127.0.0.1:8000;
|
|
proxy_http_version 1.1;
|
|
proxy_connect_timeout 5s;
|
|
proxy_read_timeout 60s;
|
|
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;
|
|
proxy_set_header X-API-Token $http_x_api_token;
|
|
proxy_set_header Authorization $http_authorization;
|
|
proxy_pass_request_headers on;
|
|
}
|
|
|
|
# без trailing slash тоже (на всякий случай)
|
|
location = /api {
|
|
return 301 /api/;
|
|
}
|
|
|
|
location = /404.html {
|
|
root /usr/share/nginx/html;
|
|
}
|
|
|
|
location = /502.html {
|
|
root /usr/share/nginx/html;
|
|
}
|
|
|
|
location ~* \.apk$ {
|
|
default_type application/vnd.android.package-archive;
|
|
add_header Content-Disposition "attachment";
|
|
try_files $uri =404;
|
|
}
|
|
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
}
|