[Owncloud] nginx configuration

Diederik de Haas didi.debian at cknow.org
Wed Nov 28 17:45:34 UTC 2012


Hi,

I want to make owncloud run under nginx (with php-fpm) and to test things out 
I've created a vm (hostname=ocdeb-mysql-nginx) and installed the required 
software and placed owncloud's files under /usr/share/owncloud/.
I've created /etc/nginx/conf.d/owncloud.conf with the contents pasted below.

I want to make owncloud available under http://<hostname>/owncloud/, but so far 
I've only managed to get it to work under http://<hostname>/.
With apache I can just say "Alias /owncloud /usr/share/owncloud", but how to do 
that with nginx?

Thanks in advance,
  Diederik


owncloud.conf:
==============================
server {
        listen 80;
        server_name ocdeb-mysql-nginx;
        root /usr/share/owncloud;
        index index.php;

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

        # default try order
        location / {
                try_files $uri $uri/ @webdav;
        }

        # owncloud WebDAV
        location @webdav {
                fastcgi_split_path_info ^(.+\.php)(/.*)$;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_param SCRIPT_FILENAME 
$document_root$fastcgi_script_name;
                include fastcgi_params;
        }

        # enable php
        location ~ \.php$ {
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_param SCRIPT_FILENAME 
$document_root$fastcgi_script_name;
                include fastcgi_params;
        }
}
==============================



More information about the Owncloud mailing list