--- title: Zotero date: 2014-12-09 12:12:12 tags: - zotero - webdav - nginx - apache --- [Zotero](https://www.zotero.org/) is an Open Source tool that lets you organise your bibliography, syncing it with the cloud. Unlike other alternatives such as [Mendeley](http://www.mendeley.com), Zotero can upload the attachments and data to a private cloud via WebDav. If you use nginx as your web server, know that even though it provides partial support for webdav, Zotero needs more than that. Hence, you will need another webdav server, and optionally let nginx proxy to it. This short post provides the basics to get that set-up working under Debian/Ubuntu. Setting up Apache ----------------- First we need to install Apache: ```bash sudo apt-get install apache2 ``` Change the head of "/etc/apache2/sites-enabled/000-default" to: ```apache ``` Then, create a file /etc/apache2/sites-available/webdav: ```apache Alias /dav /home/webdav/dav Dav on Order Allow,Deny Allow from all Dav On Options +Indexes AuthType Basic AuthName DAV AuthBasicProvider file AuthUserFile /home/webdav/.htpasswd Require valid-user ``` Ideally, you want your webdav folders to be private, adding authentication to them. So you need to create the webdav and zotero users and add the passwords to an htpasswd file. Even though you could use a single user, since you will be configuring several clients with your credentials I encourage you to create the zotero user as well. This way you can always change the password for zotero without affecting any other application using webdav. ```bash sudo adduser webdav sudo htpasswd -c /home/webdav/.htpasswd webdav sudo htpasswd /home/webdav/.htpasswd zotero sudo mkdir -p /home/webdav/dav/zotero ``` Enable the site and restart apache: ```bash sudo a2enmod webdav sudo a2enmod dav_fs sudo a2ensite webdav sudo service apache2 restart ``` At this point everything should be working at :880/dav/zotero Setting up NGINX ---------------- After the Apache side is working, we can use nginx as a proxy to get cleaner URIs. In your desired site/location, add this: ```nginx location /dav { client_max_body_size 20M; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header Host $host; proxy_pass http://127.0.0.1:880; } ``` Now just reload nginx: ```bash sudo service nginx force-reload ``` Extras ------ - [Zotero Reader](http://zoteroreader.com/) - HTML5 client - [Zandy](https://github.com/ajlyon/zandy) - Android Open Source client