Nginx, Owncloud

Il file di configurazione per "Owncloud": /etc/nginx/owncloud.conf

 

add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;";
add_header X-Content-Type-Options nosniff;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Robots-Tag none;

client_max_body_size 10G;
fastcgi_buffers 64 4K;

gzip off;

rewrite ^/owncloud/caldav(.*)$ /owncloud/remote.php/caldav$1 redirect;
rewrite ^/owncloud/carddav(.*)$ /owncloud/remote.php/carddav$1 redirect;
rewrite ^/owncloud/webdav(.*)$ /owncloud/remote.php/webdav$1 redirect;

location /owncloud/ {
  error_page 403 /owncloud/core/templates/403.php;
  error_page 404 /owncloud/core/templates/404.php;

  rewrite ^/.well-know/host-meta /public.php?service=host-meta last;
  rewrite ^/.well-know/host-meta.json /public.php?service=host-meta-json last;

  rewrite ^/.well-know/carddav /remote.php/carddav/ redirect;
  rewrite ^/.well-know/caldav /remote.php/caldav/ redirect;

  rewrite ^(/core/doc/[^\/]+/)$ $1/index.html;

  try_files $uri $uri/ /index.php;

  location ~ \.php(?:$|/) {
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass   unix:/var/run/php5-fpm.sock;
    fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include /etc/nginx/fastcgi_params;
    fastcgi_param  PATH_INFO $fastcgi_path_info;
    fastcgi_param  HTTPS on;
    fastcgi_param  modHeadersAvailable true;
  }
}

location = /owncloud/robots.txt {
  allow all;
  log_not_found off;
  access_log off;
}

location ~ ^/owncloud/(?:\.htaccess|data|config|db_structure\.xml|README) {
  deny all;
}

#location ~ \..*/.\.php$ {
#  return 403;
#}

#location ~ (^|/)\. {
#  return 403;
#}


location ~* \.(?:js|css|gif|png|ico|jpg|jpeg|bmp|swf)$ {
  expires 30d;
  access_log off;
}

# Block access to .htaccess files
location ~ /\.ht {
  deny all;
}