我已经安装了bitnami nginx栈(nginx,php-fpm,mysql)来运行多个drupal 7和node.js站点,但是现在只有一个D7站点被安装了。
file upload在localhost中完美工作。 但是,只要我上传到Linode vps与bitnami nginx堆栈,它开始显示上传问题。
对于较小的文件(〜60kb)上传工作正常。 但是对于更大的文件,上传暂停。 less数情况下:563KB文件 – 上传停止在46%3.5MB文件 – 停止在〜7%
访问日志看起来像这样的POST(给出408):
xxxx - - [07/Sep/2014:20:15:24 +0530] "POST /node/add/profile HTTP/1.1" 408 0 "http://mysite[dot]com/node/add/profile" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.94 Safari/537.36"
尝试了一切,我可以在nginx.conf文件,但没有什么帮助。
user daemon daemon; worker_processes 1; error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access-mysite.com.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; fastcgi_buffers 8 16k; fastcgi_buffer_size 32k; server { server_name mysite.com; root /var/www/mysite; ## <-- Your only path reference. # Enable compression, this will help if you have for instance advagg module # by serving Gzip versions of the files. gzip_static on; client_body_in_file_only clean; client_body_buffer_size 32K; client_max_body_size 300M; sendfile on; send_timeout 5m; client_header_timeout 5m; client_body_timeout 10; fastcgi_max_temp_file_size 2048m; location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { allow all; log_not_found off; access_log off; } # This matters if you use drush prior to 5.x # After 5.x backups are stored outside the Drupal install. #location = /backup { # deny all; #} # Very rarely should these ever be accessed outside of your lan location ~* \.(txt|log)$ { allow 192.168.0.0/16; deny all; } location ~ \..*/.*\.php$ { return 403; } # No no for private location ~ ^/sites/.*/private/ { return 403; } # Block access to "hidden" files and directories whose names begin with a # period. This includes directories used by version control systems such # as Subversion or Git to store control files. location ~ (^|/)\. { return 403; } location / { # This is cool because no php is touched for static content try_files $uri @rewrite; } location @rewrite { # You have 2 options here # For D7 and above: # Clean URLs are handled in drupal_environment_initialize(). rewrite ^ /index.php; # For Drupal 6 and bwlow: # Some modules enforce no slash (/) at the end of the URL # Else this rewrite block wouldn't be needed (GlobalRedirect) #rewrite ^/(.*)$ /index.php?q=$1; } location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini include fastcgi_params; fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_intercept_errors on; fastcgi_pass 127.0.0.1:7777; } # Fighting with Styles? This little gem is amazing. # This is for D6 #location ~ ^/sites/.*/files/imagecache/ { # This is for D7 and D8 location ~ ^/sites/.*/files/styles/ { try_files $uri @rewrite; } location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { expires max; log_not_found off; } } # another virtual host using mix of IP-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # HTTPS server # #server { # listen 443 ssl; # server_name localhost; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_cache shared:SSL:1m; # ssl_session_timeout 5m; # ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #} # client_max_body_size 300M; }
更新:testing没有使用Drupal,只是一个简单的PHP脚本 – 同样的问题。 绝对是用nginx / php-fpm做的事情!
更新2:closuresphp-fpm,并用一个带有上传字段的html页面进行testing。 同样的问题 – 它绝对是nginx或bitnami!
您在服务器定义之外有client_max_body_size。 服务器定义里面的结果是什么?
另外,@PratapSingh问另一个很好的问题 – 什么是php.ini中的max_upload_filesize限制?
试试这个解释的额外帮助。