nginx-conf

This commit is contained in:
Untone 2023-10-18 14:29:50 +03:00
parent b779075ec2
commit 7de5c3e6ed
2 changed files with 9 additions and 16 deletions

View File

@ -1,4 +1,4 @@
# sigil ver 2.1 dufok 2022-10-11 # sigil ver 2.2 dufok 2022-10-15 (with location /connect nobuffer)
# Proxy settings # Proxy settings
{{ $proxy_settings := "proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $http_connection; proxy_set_header Host $http_host; proxy_set_header X-Request-Start $msec;" }} {{ $proxy_settings := "proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $http_connection; proxy_set_header Host $http_host; proxy_set_header X-Request-Start $msec;" }}
# GZIP settings # GZIP settings
@ -47,19 +47,12 @@ server {
# Default location block # Default location block
location / { location / {
proxy_pass http://172.17.0.28:8080; proxy_pass http://{{ $.APP }}-{{ $upstream_port }};
add_header 'Cache-Control' 'no-cache'; {{ $proxy_settings }}
add_header 'Content-Type' 'text/event-stream'; {{ $gzip_settings }}
add_header 'Connection' 'keep-alive'; {{ $cors_headers_options }}
proxy_set_header Upgrade $http_upgrade; {{ $cors_headers_post }}
proxy_set_header Connection "upgrade"; {{ $cors_headers_get }}
proxy_buffering off;
proxy_cache off;
proxy_read_timeout 36000s;
{{ $proxy_settings }}
{{ $cors_headers_options }}
{{ $cors_headers_post }}
{{ $cors_headers_get }}
} }
# Error pages # Error pages
@ -102,4 +95,4 @@ upstream {{ $.APP }}-{{ $upstream_port }} {
server {{ $listener_ip }}:{{ $upstream_port }}; server {{ $listener_ip }}:{{ $upstream_port }};
{{ end }} {{ end }}
} }
{{ end }} {{ end }}

View File

@ -64,7 +64,7 @@ async fn connect_handler(
ServerError("Internal Server Error") ServerError("Internal Server Error")
})?; })?;
let (tx, mut rx) = broadcast::channel(100); let (tx, rx) = broadcast::channel(100);
let state_clone = state.clone(); let state_clone = state.clone();
let handle = tokio::spawn(async move { let handle = tokio::spawn(async move {
let conn = state_clone.redis.get_async_connection().await.unwrap(); let conn = state_clone.redis.get_async_connection().await.unwrap();