【问题标题】:Event streams with nginx over tls通过 tls 使用 nginx 的事件流
【发布时间】:2020-07-14 20:57:13
【问题描述】:

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

谢谢。 [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/*;
}

【问题讨论】:

    标签: php ssl nginx event-stream


    【解决方案1】:

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

    proxy_buffering off;
    

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-09-10
      • 1970-01-01
      • 2019-12-27
      • 2012-11-20
      • 2011-09-29
      • 2021-04-28
      相关资源
      最近更新 更多