[英]Simultaneous file uploads return 403 forbidden with nginx, and php-fpm
我有一個應用程序,允許通過拖放同時上傳文件。 此應用目前:
nginx
w / php-fpm
上運行php 5.6
這是我遇到的問題:
只要有多個並發帖子,就會發生這種情況。 它們不必是文件上傳。
此功能適用於除登台服務器之外的所有服務器。 本地開發機器和生產盒沒有這個問題。
通過拖放到頁面上傳文件。 每個文件都通過ajax在單獨的請求中上傳。
尺寸無關緊要小圖像失敗以及更大的圖像。
我正在尋找環境之間不匹配的配置參數,但差別尚不明顯。 我應該檢查什么想法?
我的nginx網站配置:
server {
listen *:443 ssl;
server_name stagingsite.com ;
ssl on;
ssl_certificate /site.crt;
ssl_certificate_key /site.key;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM- SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384: ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256- SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES- CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256: AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:! MD5:!PSK:!RC4";
ssl_prefer_server_ciphers on;
client_max_body_size 256m;
index index.html index.htm index.php;
access_log /var/log/nginx/site.access.log;
error_log /var/log/nginx/site.error.log;
root /var/www/site/webroot;
location / {
root /site/webroot;
try_files $uri $uri/ /index.php$is_args$args;
autoindex off;
index index.html index.htm index.php;
}
location ~ \.php$ {
set $path_info $fastcgi_path_info;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
try_files $uri $uri/ /index.php$is_args$args;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $request_filename;
}
sendfile off;
}
我發現了我的問題的答案。 問題存在於CakePhp2
的會話配置中。 auto-regenerate選項設置為true,導致應用程序為每個請求生成新的會話ID。 第二個請求進入后,它不知道新的會話ID。 到第三個請求進入會話時,ID一起丟失了。
導致發現解決方案的資源在這里:
如何解決“CAKEPHP 2.x中禁止的ajax 403錯誤”
我希望這個問題有助於下一個遇到類似問題的人。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.