繁体   English   中英

通过 tls 使用 nginx 的事件流

[英]Event streams with nginx over tls

我制作了一个 php 事件流脚本,当 nginx 未启用 tls (ssl) 但启用 tls 后,对事件 stream 的请求保持未决时,该脚本工作得非常好。 我尝试禁用 ssl 缓存、代理缓存([这里][1] 是我的网站配置文件),但我对 nginx 还是很陌生。 我还在我的 php 脚本中设置了 header "X-Accel-Buffering: no" 但没有结果。 另外,这是我的 ngninx conf文件 我的配置中缺少一行吗?

谢谢。 [1]: https://pastebin.com/a2NutTUA

server {
    listen 8943 default_server ssl;
    listen [::]:8943 default_server ssl;
    ssl on;
    ssl_certificate     /etc/letsencrypt/live/REDACTED-0001/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/REDACTED-0001/privkey.pem;
    ssl_protocols       TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers         HIGH:!aNULL:!MD5;
    ssl_buffer_size 0;
    root /var/www/nginxlive;
    index index.html index.htm index.nginx-debian.html index.php;
    server_name localhost;
    proxy_set_header Connection '';
    proxy_http_version 1.1;
    chunked_transfer_encoding off;
    proxy_buffering off;
    proxy_cache off;
    proxy_buffer_size 0;

    location / {
            try_files $uri $uri/ =404;
    }
    location ~ \.php$ {
            include snippets/fastcgi-php.conf;
            fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
    }
}
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
    worker_connections 768;
    multi_accept on;
}
 
http {
ssl_session_cache   shared:SSL:10m;
ssl_session_timeout 10m;
    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;
    include /etc/nginx/mime.types;
    default_type application/octet-stream;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
    ssl_prefer_server_ciphers on;
    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;
    gzip off;
    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}

刚遇到和你一样的问题,并受到启发使用

proxy_buffering off;

将此标志与最小代理配置一起使用对我有用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM