[OC7] Unable to download any file OC 7.0 RC2
Unable to download any content from web interface. It includes owncloud data folder and external NAS mounted in VPS under /mnt/data/. Download from Dropbox and FTP added as external storage works.
Upload works for any file. WebDav upload and download works too.
Steps to reproduce
- Click on download text on any content
or
- Click on share with URL
- Insert the generated URL in your browser
- Click on download
Expected behaviour
The download proccess will begin
Actual behaviour
- Firefox (latest) - File not found! Firefox cannot find file https://cloud.example.com/index.php/apps/files/ajax/download.php?dir=/Data/videos&files=xxxxxxxxxx.MOV
- Chrome (latest) - This web site is not available
Server configuration
Operating system: Debian Wheezy 7.6 (OpenVZ VPS Server)
Web server: Nginx 1.6.0
Database: MariaDB 10.0.12
PHP version: PHP-FPM 5.5.14 dotdeb.1
ownCloud version: 7.0 RC2
Updated from an older ownCloud or fresh install: fresh install
List of activated apps: Activity Deleted files Documents External storage support First Run Wizard Full Text Search PDF Viewer Pictures Share Files Text Editor Updater Versions Video Viewer
The content of config/config.php:
<?php
$CONFIG = array (
'instanceid' => 'XXXXXXX',
'passwordsalt' => 'XXXXXXX',
'datadirectory' => '/var/www/cloud/html/data',
'dbtype' => 'mysql',
'version' => '7.0.0.5',
'dbname' => 'XXXXXXXXXX',
'dbhost' => 'localhost',
'dbtableprefix' => 'XXXXXXXX',
'dbuser' => 'XXXXXXX',
'dbpassword' => 'XXXXXXXXXX',
'installed' => true,
'forcessl' => true,
'theme' => '',
'maintenance' => false,
'loglevel' => '0',
'logdateformat' => 'd. M Y, H:i:s e',
'trusted_domains' =>
array (
0 => 'cloud.example.com',
),
'mail_from_address' => 'admin',
'mail_smtpmode' => 'php',
'mail_domain' => 'cloud.example.com',
);
The content of Nginx virtual host config:
server {
listen 80;
listen [::]:80;
server_name cloud.example.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 spdy;
listen [::]:443 spdy;
server_name cloud.example.com;
ssl on;
ssl_certificate /etc/ssl/nginx/server.crt;
ssl_certificate_key /etc/ssl/nginx/server.key;
ssl_prefer_server_ciphers on;
ssl_protocols TLSv1.2;
ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA;
add_header Strict-Transport-Security max-age=15768000;
keepalive_timeout 70;
ssl_dhparam /etc/ssl/nginx/dh4096.pem;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
access_log /var/www/cloud/logs/access.log;
error_log /var/www/cloud/logs/error.log;
root /var/www/cloud/html;
dav_methods off;
client_max_body_size 16G;
fastcgi_buffers 64 4K;
rewrite ^/caldav(.*)$ /remote.php/caldav$1 redirect;
rewrite ^/carddav(.*)$ /remote.php/carddav$1 redirect;
rewrite ^/webdav(.*)$ /remote.php/webdav$1 redirect;
index index.php;
error_page 403 /core/templates/403.php;
error_page 404 /core/templates/404.php;
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ~ ^/(data|config|\.ht|db_structure\.xml|README) {
deny all;
}
location / {
# The following 2 rules are only needed with webfinger
rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last;
rewrite ^/.well-known/carddav /remote.php/carddav/ redirect;
rewrite ^/.well-known/caldav /remote.php/caldav/ redirect;
rewrite ^(/core/doc/[^\/]+/)$ $1/index.html;
try_files $uri $uri/ index.php;
}
location ~ ^/mnt/data/ {
internal;
root /;
}
location ~ ^/var/www/cloud/html/data/ {
internal;
root /;
}
location ~ ^/tmp/oc-noclean/.+$ {
internal;
root /;
}
location ~ ^(.+?\.php)(/.*)?$ {
try_files $1 = 404;
fastcgi_read_timeout 300;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$1;
fastcgi_param PATH_INFO $2;
fastcgi_param HTTPS on;
fastcgi_param MOD_X_ACCEL_REDIRECT_ENABLED on;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
# Optional: set long EXPIRES header on static assets
location ~* ^.+\.(jpg|jpeg|gif|bmp|ico|png|css|js|swf)$ {
expires 30d;
# Optional: Don't log access to assets
access_log off;
}
}
The content of Nginx config nginx.conf:
user www-data;
worker_processes 4;
pid /run/nginx.pid;
events {
worker_connections 768;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
server_tokens off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
gzip on;
gzip_disable "msie6";
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
The content of php.ini:
[PHP]
engine = On
short_open_tag = Off
asp_tags = Off
precision = 14
output_buffering = Off
zlib.output_compression = Off
implicit_flush = Off
unserialize_callback_func =
serialize_precision = 17
disable_functions = pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
disable_classes =
zend.enable_gc = On
expose_php = Off
max_execution_time = 30
max_input_time = 60
memory_limit = 512M
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
display_errors = Off
display_startup_errors = Off
log_errors = On
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
track_errors = Off
html_errors = On
variables_order = "GPCS"
request_order = "GP"
register_argc_argv = Off
auto_globals_jit = On
post_max_size = 16G
auto_prepend_file =
auto_append_file =
default_mimetype = "text/html"
doc_root =
user_dir =
enable_dl = Off
file_uploads = On
upload_max_filesize = 16G
max_file_uploads = 20
allow_url_fopen = On
allow_url_include = Off
default_socket_timeout = 60
[CLI Server]
cli_server.color = On
[Date]
date.timezone = "Europe/Prague"
[Pdo_mysql]
pdo_mysql.cache_size = 2000
pdo_mysql.default_socket=
[mail function]
SMTP = localhost
smtp_port = 25
mail.add_x_header = On
[SQL]
sql.safe_mode = Off
[ODBC]
odbc.allow_persistent = On
odbc.check_persistent = On
odbc.max_persistent = -1
odbc.max_links = -1
odbc.defaultlrl = 4096
odbc.defaultbinmode = 1
[Interbase]
ibase.allow_persistent = 1
ibase.max_persistent = -1
ibase.max_links = -1
ibase.timestampformat = "%Y-%m-%d %H:%M:%S"
ibase.dateformat = "%Y-%m-%d"
ibase.timeformat = "%H:%M:%S"
[MySQL]
mysql.allow_local_infile = On
mysql.allow_persistent = On
mysql.cache_size = 2000
mysql.max_persistent = -1
mysql.max_links = -1
mysql.default_port =
mysql.default_socket =
mysql.default_host =
mysql.default_user =
mysql.default_password =
mysql.connect_timeout = 60
mysql.trace_mode = Off
[MySQLi]
mysqli.max_persistent = -1
mysqli.allow_persistent = On
mysqli.max_links = -1
mysqli.cache_size = 2000
mysqli.default_port = 3306
mysqli.default_socket =
mysqli.default_host =
mysqli.default_user =
mysqli.default_pw =
mysqli.reconnect = Off
[mysqlnd]
mysqlnd.collect_statistics = On
mysqlnd.collect_memory_statistics = Off
[PostgreSQL]
pgsql.allow_persistent = On
pgsql.auto_reset_persistent = Off
pgsql.max_persistent = -1
pgsql.max_links = -1
pgsql.ignore_notice = 0
pgsql.log_notice = 0
[Sybase-CT]
sybct.allow_persistent = On
sybct.max_persistent = -1
sybct.max_links = -1
sybct.min_server_severity = 10
sybct.min_client_severity = 10
[bcmath]
bcmath.scale = 0
[Session]
session.save_handler = files
session.use_strict_mode = 0
session.use_cookies = 1
session.use_only_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.cookie_httponly =
session.serialize_handler = php
session.gc_probability = 0
session.gc_divisor = 1000
session.gc_maxlifetime = 1440
session.referer_check =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.hash_function = 0
session.hash_bits_per_character = 5
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"
[MSSQL]
mssql.allow_persistent = On
mssql.max_persistent = -1
mssql.max_links = -1
mssql.min_error_severity = 10
mssql.min_message_severity = 10
mssql.compatibility_mode = Off
mssql.secure_connection = Off
[Assertion]
[COM]
[mbstring]
[gd]
[exif]
[Tidy]
tidy.clean_output = Off
[soap]
soap.wsdl_cache_enabled=1
soap.wsdl_cache_dir="/tmp"
soap.wsdl_cache_ttl=86400
soap.wsdl_cache_limit = 5
[sysvshm]
[ldap]
ldap.max_links = -1
[mcrypt]
[dba]
[opcache]
[curl]
The content of PHP www pool:
user = www-data
group = www-data
listen = /var/run/php5-fpm.sock
listen.owner = www-data
listen.group = www-data
listen.mode = 0660
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
chdir = /
Are you using external storage, if yes which one: NAS connected and mounted to VPS under /mnt/data/ FTP Dropbox
Are you using encryption: no
Client configuration
Firefox 30 Chrome 35.0.1916.153 m
Operating system: Windows 8.1 x64
Logs
Web server error log
2014/07/15 14:49:49 [error] 15851#0: *41 access forbidden by rule, client: XXX.XXX.XXX.XXX, server: cloud.example.com, request: "GET /index.php/apps/files/ajax/download.php?dir=%2F&files=xxxxxxxx.xlsx HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock", host: "cloud.example.com", referrer: "https://cloud.example.com/index.php/apps/files/?dir=%2F"
2014/07/16 12:01:07 [error] 15851#0: *2632 access forbidden by rule, client: XXX.XXX.XXX.XXX, server: cloud.example.com, request: "GET /index.php/apps/files/ajax/download.php?dir=%2FData%2Fvideos&files=xxxxxxxxx.MOV HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock", host: "cloud.example.com", referrer: "https://cloud.example.com/index.php/apps/files/?dir=%2FData%2Fvideos"
2014/07/16 12:04:36 [error] 15851#0: *2682 access forbidden by rule, client: XXX.XXX.XXX.XXX, server: cloud.example.com, request: "GET /public.php?service=files&t=1ed7033edc164a78da9e3bb2112a602d&download HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock", host: "cloud.example.com", referrer: "https://cloud.example.com/public.php?service=files&t=1ed7033edc164a78da9e3bb2112a602d"
2014/07/16 17:12:41 [error] 15852#0: *4402 access forbidden by rule, client: XXX.XXX.XXX.XXX, server: cloud.example.com, request: "GET /index.php/apps/files/ajax/download.php?dir=%2FData%2Fvideos&files=xxxxxxxx.MOV HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock", host: "cloud.example.com", referrer: "https://cloud.example.com/index.php/apps/files/?dir=%2FData%2Fvideos"
2014/07/16 17:13:19 [error] 15851#0: *4435 access forbidden by rule, client: XXX.XXX.XXX.XXX, server: cloud.example.com, request: "GET /index.php/apps/files/ajax/download.php?dir=%2FData%2Fvideos&files=xxxxxxxxx.MOV HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock", host: "cloud.example.com", referrer: "https://cloud.example.com/index.php/apps/files/?dir=%2FData%2Fvideos"
ownCloud log (data/owncloud.log)
nothing related to download issues
Downloads aren't working because you enabled x-accel but aren't using the x-accel configuration for owncloud 7 (the needed nginx configuration was made simpler/cleaner).
https://github.com/owncloud/documentation/blob/master/admin_manual/configuration/xsendfile.rst#configuration-2
From looking at your nginx config I'm guessing you are using a non-default datadirectory '/mnt/data'. And I believe you have not setup any external storage mountpoints.
Replace this..
location ~ ^/mnt/data/ {
internal;
root /;
}
location ~ ^/var/www/cloud/html/data/ {
internal;
root /;
}
location ~ ^/tmp/oc-noclean/.+$ {
internal;
root /;
}
With this..
location ^~ /data {
internal;
alias /mnt/data;
}
Hello Josh, thanks for your suggestion, as described in the issues I use both, default data directory as well as external storage mounted to webserver filestystem under /mnt/data and added under owncloud admin.
Can you post a screenshot of you external storage setup from the admin page?
Here it goes :-)
The latest documentation (which will ship with OC7) should tell you everything you need to know. You may have to play around with the below because I never tested spaces or special characters.
location ^~ /data {
internal;
location "/data/tomas/files/Web Storage" {
alias /var/www;
}
location ~ ^/data/[^/]+/files/Data/(.+)$ {
alias /mnt/data/$1;
}
}
Special characters are just in my full name, username is simply just tomas :-)
there is no longer need to add tmp directory to locations?
even easier =D
please try the above and see if downloads work as expected from all relevant locations.
Seems like the suggestion above fixed it...
sounds good. please close this issue if it's solved. thanks
thanx a lot for the help :-)
No problem =]
Thanks, Josh.
Worked for me too.