Files
smart-parking-platform/backend/nginx.conf
T

86 lines
1.9 KiB
Nginx Configuration File

user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
}
http {
sendfile on;
tcp_nopush on;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
ssl_protocols TLSv1.2 TLSv1.3;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
gzip on;
include /etc/nginx/conf.d/*.conf;
server {
listen 80;
server_name _;
client_max_body_size 500M;
location / {
index index.html;
root /usr/share/smart-parking-platform/frontend/dist;
try_files $uri $uri/ =404;
}
location /public/ {
proxy_pass http://localhost:3000/public/;
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection upgrade;
proxy_set_header Accept-Encoding gzip;
}
location /api/ {
proxy_pass http://localhost:3000/api/;
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection upgrade;
proxy_set_header Accept-Encoding gzip;
}
location /ws {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_read_timeout 1h;
}
location /hls {
types {
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
alias /dev/shm/nginx-live;
add_header Cache-Control no-cache;
add_header Access-Control-Allow-Origin *;
}
}
}
rtmp {
server {
listen 1515;
chunk_size 4096;
application live {
live on;
hls on;
hls_path /dev/shm/nginx-live;
hls_cleanup on;
hls_type live;
hls_fragment_naming system;
hls_fragment 2s;
hls_playlist_length 10s;
hls_fragment_slicing plain;
}
}
}