diff --git a/AsbCloudWebApi/Docs/Nginx/nginx.conf b/AsbCloudWebApi/Docs/Nginx/nginx.conf new file mode 100644 index 00000000..362ba811 --- /dev/null +++ b/AsbCloudWebApi/Docs/Nginx/nginx.conf @@ -0,0 +1,151 @@ +user www-data; +worker_processes auto; +pid /run/nginx.pid; +include /etc/nginx/modules-enabled/*.conf; + +events { + worker_connections 768; + # multi_accept on; +} + +http { + +proxy_cache_path /home/asb/web-content/cache keys_zone=map-cache:1024m; + +server{ + listen 5085; + charset UTF-8; + + location / { + root /home/asb/public_files; + autoindex on; + autoindex_exact_size off; + autoindex_format html; + autoindex_localtime on; + } +} + +server { + listen 5090; + proxy_buffering on; + proxy_buffer_size 1M; + proxy_buffers 48 1M; + proxy_cache_lock on; + proxy_cache_lock_age 5s; + proxy_http_version 1.1; + proxy_cache_valid 200 61d; + proxy_cache_use_stale error timeout; + + + #путь до папки с ui-проектом в файловой системе + root /home/asb/AsbCloudUI; + index index.html; + + location / { + try_files $uri /index.html; + } + + #запрос, начинающийся с /api или /auth или /hubs + location ~ ^/(api|auth|hubs)/ { + + #адрес, на который будут пересылаться запросы от клиентов + proxy_pass http://127.0.0.1:5000; + + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } + + location /favicon.ico { + alias /home/asb/web-content/images/favicon.ico; + add_header Cache-Control "public"; + expires 4h; + } + + location /config.json { + alias /home/asb/web-content/config.json; + add_header Cache-Control "public"; + expires 4h; + } + + location /images/ { + root /home/asb/web-content; + add_header Cache-Control "public"; + expires 4h; + } + + location /map/a/ { + proxy_pass https://a.tile.openstreetmap.org/; + proxy_cache map-cache; + proxy_cache_key $request_uri; + } + location /map/b/ { + proxy_pass https://b.tile.openstreetmap.org/; + proxy_cache map-cache; + proxy_cache_key $request_uri; + } + location /map/c/ { + proxy_pass https://c.tile.openstreetmap.org/; + proxy_cache map-cache; + proxy_cache_key $request_uri; + } + location /map/ { + proxy_pass https://b.tile.openstreetmap.org/; + proxy_cache map-cache; + proxy_cache_key $request_uri; + } +} + + ## + # Basic Settings + ## + + sendfile on; + tcp_nopush on; + tcp_nodelay on; + keepalive_timeout 65; + types_hash_max_size 2048; + # server_tokens off; + + # server_names_hash_bucket_size 64; + # server_name_in_redirect off; + + include /etc/nginx/mime.types; + default_type application/octet-stream; + + ## + # SSL Settings + ## + + ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE + ssl_prefer_server_ciphers on; + + ## + # Logging Settings + ## + + access_log /var/log/nginx/access.log; + error_log /var/log/nginx/error.log; + + ## + # Gzip Settings + ## + + gzip on; + + # gzip_vary on; + # gzip_proxied any; + # gzip_comp_level 6; + # gzip_buffers 16 8k; + # gzip_http_version 1.1; + # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; + + ## + # Virtual Host Configs + ## + + include /etc/nginx/conf.d/*.conf; + include /etc/nginx/sites-enabled/*; +}