docker - Nginx 允许来自同一个 ip 的多个连接
问题描述
我正在使用“php:7.4-fpm”docker 映像并通过“apt-get install”安装了额外的“nginx”包。
如果客户端通过网页启动长时间运行的脚本,则客户端无法打开另一个页面,直到第一个脚本返回响应。有没有办法允许每个 ip/client 有多个连接?
添加了以下配置:
server {
server_name ~.*;
root /usr/src/app/public;
# Add logging
error_log /var/log/nginx/error.log warn;
access_log /var/log/nginx/access.log;
# Add stdout logging
error_log /dev/stderr warn;
# Security - Hide nginx version number in error pages and Server header - dev is ok
server_tokens on;
# reduce the data that needs to be sent over network
gzip on;
gzip_min_length 10240;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css text/xml application/json text/javascript application/x-javascript application/xml;
gzip_disable "MSIE [1-6]\.";
#
location / {
try_files $uri /index.php$is_args$args;
}
# pass the PHP scripts to FastCGI server listening on socket
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass 127.0.0.1:9000;
# fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
fastcgi_param PATH_TRANSLATED $document_root/$fastcgi_path_info;
fastcgi_buffers 32 32k; # increase the buffer size for PHP-FTP
fastcgi_buffer_size 64k; # increase the buffer size for PHP-FTP
fastcgi_connect_timeout 60;
fastcgi_send_timeout 3600;
fastcgi_read_timeout 3600;
include fastcgi_params;
}
# cache static
location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
access_log off;
log_not_found off;
expires -1;
}
# deny access to . files, for security
location ~ /\. {
access_log off;
log_not_found off;
deny all;
}
}
解决方案
推荐阅读
- python - 如何在世界坐标系中绘制相机位置?
- node.js - 在中间件文件中编码或清理请求正文
- java - Spring:使用@EntityScan 禁用自动实体发现
- javascript - 计算机在剪刀石头布 JavaScript 中选择不同的答案
- r - Creating a function to replace NAs from one data frame with values from another
- javascript - 滚动进度指示器不适用于 fullpage.js
- reactjs - React 中的悬念承诺何时执行?
- sql - case 语句中的多个条件重复表中的行
- azure - 如何使用 terraform.. 在 Azure 服务总线中创建创建多个主题和多个订阅?
- python - AWS Glue - 将 Json 响应从 GET(REST API) 请求转换为 DataFrame/DynamicFramce 并将其存储在 s3 存储桶中