Quantcast
Channel: Journal » Nginx
Viewing all articles
Browse latest Browse all 2

OwnCloud with Nginx

$
0
0

OwnCloud is a neat gadget for putting your files up somewhere and getting them back in a nicer interface than the usual directory index + it has document versioning and a bunch of other features. This post is basically just a huge nginx configuration file which shows the config that works for me using a self-signed certificate.

And here she is:

server {
listen 80;
server_name thy.server.com;
rewrite ^ https://$server_name$request_uri? permanent;  # enforce https
}

server {
listen 443 ssl;
server_name thy.server.com;

ssl_certificate /etc/nginx/ssl/host.cert;
ssl_certificate_key /etc/nginx/ssl/host.key;

access_log /var/log/nginx/owncloud-access.log main;
error_log /var/log/nginx/owncloud-error.log info;

root /var/www/owncloud;

client_max_body_size 20G; # set max upload size, remember to update php.ini as well
fastcgi_buffers 64 4K;

rewrite ^/caldav((/|$).*)$ /remote.php/caldav$1 last;
rewrite ^/carddav((/|$).*)$ /remote.php/carddav$1 last;
rewrite ^/webdav((/|$).*)$ /remote.php/webdav$1 last;

index index.php;
error_page 403 = /core/templates/403.php;
error_page 404 = /core/templates/404.php;

location ~ ^/(data|config|.ht|db_structure.xml|README) { deny all; }

location / {
  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 ~ ^(?<script_name>.+?.php)(?<path_info>/.*)?$ {
  try_files $script_name = 404;
  include fastcgi_params;
  fastcgi_param PATH_INFO $path_info;
  fastcgi_param HTTPS on;
  fastcgi_pass 127.0.0.1:9000;
}

location ~* ^.+.(jpg|jpeg|gif|bmp|ico|png|css|js|swf)$ { expires max; access_log off; }

}


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images