1
0
mirror of https://github.com/balkian/balkian.github.com.git synced 2024-11-05 11:31:42 +00:00
balkian.github.com/post/2014-12-09-zotero/index.html
2021-01-19 12:35:27 +01:00

327 lines
18 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Balkian&#39;s site - WELCOME</title>
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="../../font-awesome/css/all.css">
<link rel="stylesheet" media="only screen" href="../../css/main.css">
<link href='http://fonts.googleapis.com/css?family=Open+Sans:300|Comfortaa' rel='stylesheet' type='text/css'>
</head>
<body>
<div id="container" class="container">
<div id="contentwrapper">
<div id="content">
<header id="header">
<ul class="navbar" id="navbar">
<a href="../../">
<li >
<i class="fa fa-home fa-large"></i>
</li></a>
<a href="../../post/"><li class='' >Blog
</li></a>
<a href="../../tags/"><li class='' >Tags
</li></a>
<a href="../../cheatsheet/"><li class='' >Cheatsheets
</li></a>
<a href="../../project/"><li class='' >Projects
</li></a>
<a href="../../page/todo/"><li class='' >To-do
</li></a>
<a href="//jfernando.es" target="_blank"><li>
CV
</li></a>
<a href="../../search"><li>
<i class="fa fa-search"></i>
</li></a>
</ul>
</header>
<h2>Zotero</h2>
<span class="date">2014/12/09</span>
<span>
<a class="tag" href='../../tags/zotero'><span class="label">zotero</span></a>
<a class="tag" href='../../tags/webdav'><span class="label">webdav</span></a>
<a class="tag" href='../../tags/nginx'><span class="label">nginx</span></a>
<a class="tag" href='../../tags/apache'><span class="label">apache</span></a>
</span>
<h3></h3>
<p><a href="https://www.zotero.org/">Zotero</a> is an Open Source tool that lets you
organise your bibliography, syncing it with the cloud. Unlike other
alternatives such as <a href="http://www.mendeley.com">Mendeley</a>, Zotero can
upload the attachments and data to a private cloud via WebDav.</p>
<p>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.</p>
<h2 id="setting-up-apache">Setting up Apache</h2>
<p>First we need to install Apache:</p>
<div class="highlight"><div style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">
<table style="border-spacing:0;padding:0;margin:0;border:0;width:auto;overflow:auto;display:block;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">sudo apt-get install apache2
</code></pre></td></tr></table>
</div>
</div><p>Change the head of &ldquo;/etc/apache2/sites-enabled/000-default&rdquo; to:</p>
<div class="highlight"><div style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">
<table style="border-spacing:0;padding:0;margin:0;border:0;width:auto;overflow:auto;display:block;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-apache" data-lang="apache"><span style="color:#f92672">&lt;VirtualHost</span> <span style="color:#e6db74">*:880</span><span style="color:#f92672">&gt;</span>
</code></pre></td></tr></table>
</div>
</div><p>Then, create a file /etc/apache2/sites-available/webdav:</p>
<div class="highlight"><div style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">
<table style="border-spacing:0;padding:0;margin:0;border:0;width:auto;overflow:auto;display:block;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 1
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 2
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 3
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 4
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 5
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 6
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 7
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 8
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f"> 9
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">10
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">11
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">12
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">13
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-apache" data-lang="apache">Alias <span style="color:#e6db74">/dav</span> <span style="color:#e6db74">/home/webdav/dav</span>
<span style="color:#f92672">&lt;Location</span> <span style="color:#e6db74">/dav</span><span style="color:#f92672">&gt;</span>
Dav <span style="color:#66d9ef">on</span>
Order Allow,Deny
Allow from <span style="color:#66d9ef">all</span>
Dav <span style="color:#66d9ef">On</span>
Options +Indexes
AuthType Basic
AuthName DAV
AuthBasicProvider file
AuthUserFile <span style="color:#e6db74">/home/webdav/.htpasswd</span>
Require valid-user
<span style="color:#f92672">&lt;/Location&gt;</span>
</code></pre></td></tr></table>
</div>
</div><p>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.</p>
<div class="highlight"><div style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">
<table style="border-spacing:0;padding:0;margin:0;border:0;width:auto;overflow:auto;display:block;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">2
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">3
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">4
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">sudo adduser webdav
sudo htpasswd -c /home/webdav/.htpasswd webdav
sudo htpasswd /home/webdav/.htpasswd zotero
sudo mkdir -p /home/webdav/dav/zotero
</code></pre></td></tr></table>
</div>
</div><p>Enable the site and restart apache:</p>
<div class="highlight"><div style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">
<table style="border-spacing:0;padding:0;margin:0;border:0;width:auto;overflow:auto;display:block;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">2
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">3
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">4
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">sudo a2enmod webdav
sudo a2enmod dav_fs
sudo a2ensite webdav
sudo service apache2 restart
</code></pre></td></tr></table>
</div>
</div><p>At this point everything should be working at
<a href="http://">http://</a>&lt;your_host&gt;:880/dav/zotero</p>
<h2 id="setting-up-nginx">Setting up NGINX</h2>
<p>After the Apache side is working, we can use nginx as a proxy to get
cleaner URIs. In your desired site/location, add this:</p>
<div class="highlight"><div style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">
<table style="border-spacing:0;padding:0;margin:0;border:0;width:auto;overflow:auto;display:block;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">2
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">3
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">4
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">5
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">6
</span><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">7
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-nginx" data-lang="nginx"><span style="color:#66d9ef">location</span> <span style="color:#e6db74">/dav</span> {
<span style="color:#f92672">client_max_body_size</span> <span style="color:#e6db74">20M</span>;
<span style="color:#f92672">proxy_set_header</span> <span style="color:#e6db74">X-Real-IP</span> $remote_addr;
<span style="color:#f92672">proxy_set_header</span> <span style="color:#e6db74">X-Forwarded-For</span> $remote_addr;
<span style="color:#f92672">proxy_set_header</span> <span style="color:#e6db74">Host</span> $host;
<span style="color:#f92672">proxy_pass</span> <span style="color:#e6db74">http://127.0.0.1:880</span>;
}
</code></pre></td></tr></table>
</div>
</div><p>Now just reload nginx:</p>
<div class="highlight"><div style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">
<table style="border-spacing:0;padding:0;margin:0;border:0;width:auto;overflow:auto;display:block;"><tr><td style="vertical-align:top;padding:0;margin:0;border:0;">
<pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code><span style="margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f">1
</span></code></pre></td>
<td style="vertical-align:top;padding:0;margin:0;border:0;;width:100%">
<pre style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-bash" data-lang="bash">sudo service nginx force-reload
</code></pre></td></tr></table>
</div>
</div><h2 id="extras">Extras</h2>
<ul>
<li><a href="http://zoteroreader.com/">Zotero Reader</a> - HTML5 client</li>
<li><a href="https://github.com/ajlyon/zandy">Zandy</a> - Android Open Source
client</li>
</ul>
</div>
<div id="sidebar" class="fixed">
<div id="badge" class="flip-container" ontouchstart="this.classList.toggle('hover');">
<div class="flipper sticky expand">
<div class="front">
<img id="avatar" class="expandx" src="../../img/me.png">
</div>
<div class="back">
<div id="about">
<div class="icons vertical-center">
<span class="coolicon"><span class="fa-stack"> <i class="fas fa-square fa-stack-2x" ></i><i class="fab fa-inverse fa-stack-1x fa-linux"></i></span><span class="explanation">Linux user</span></span>
<span class="coolicon"><span class="fa-stack"> <i class="fas fa-square fa-stack-2x" ></i><i class="fab fa-inverse fa-stack-1x fa-android"></i></span><span class="explanation">Android dev and user</span></span>
<a href="http://github.com/balkian" target="_blank"><span class="coolicon"><span class="fa-stack"> <i class="fas fa-square fa-stack-2x" ></i><i class="fab fa-inverse fa-stack-1x fa-github"></i> </span><span class="explanation">Github user</span></span></a>
<a href="http://gitlab.com/balkian" target="_blank"><span class="coolicon"><span class="fa-stack"> <i class="fas fa-square fa-stack-2x" ></i><i class="fab fa-inverse fa-stack-1x fa-gitlab"></i> </span><span class="explanation">GitLab user</span></span></a>
<span class="coolicon"><span class="fa-stack"> <i class="fas fa-square fa-stack-2x" ></i><i class="fab fa-inverse fa-stack-1x fa-stack-exchange"></i> </span><span class="explanation">StackExchange fan</span></span>
<span class="coolicon"><span class="fa-stack"> <i class="fas fa-square fa-stack-2x" ></i><i class="fas fa-inverse fa-stack-1x fa-music"></i> </span><span class="explanation">Music lover</span></span>
<span class="coolicon"><span class="fa-stack"> <i class="fas fa-square fa-stack-2x" ></i><i class="fas fa-inverse fa-stack-1x fa-film"></i> </span><span class="explanation">Movie fan</span></span>
<span class="coolicon"><span class="fa-stack"> <i class="fas fa-square fa-stack-2x" ></i><i class="fas fa-inverse fa-stack-1x fa-laptop"></i> </span><span class="explanation">Always on a PC</span></span>
<span class="coolicon"><span class="fa-stack"> <i class="fas fa-square fa-stack-2x" ></i><i class="fas fa-inverse fa-stack-1x fa-moon"></i> </span><span class="explanation">Night owl</span></span>
<span class="coolicon"><span class="fa-stack"> <i class="fas fa-square fa-stack-2x" ></i><i class="fas fa-inverse fa-stack-1x fa-terminal"></i></span> <span class="explanation">CLI user</span></span>
<span class="coolicon"><span class="fa-stack"> <i class="fas fa-square fa-stack-2x" ></i><i class="fas fa-inverse fa-stack-1x fa-flag"></i></span> <span class="explanation">I love languages</span></span>
<span class="coolicon"><span class="fa-stack"> <i class="fas fa-square fa-stack-2x" ></i><i class="fas fa-inverse fa-stack-1x fa-code"></i> </span> <span class="explanation">I love programming</span></span>
</div>
</div>
</div>
</div>
</div>
<div class="entries">
<h2 class="title">Latest entries</h2>
<dt><a href="../../post/2019-05-01-surface-go/">Linux on the Microsoft Surface Go</a></dt>
<a class="tag" href='../../tags/linux'><span class="label">linux</span></a>
<a class="tag" href='../../tags/surface-go'><span class="label">surface go</span></a>
<a class="tag" href='../../tags/config'><span class="label">config</span></a>
<dt><a href="../../post/2019-01-06-zigbee2mqtt/">Controlling Zigbee devices with MQTT</a></dt>
<a class="tag" href='../../tags/mqtt'><span class="label">mqtt</span></a>
<a class="tag" href='../../tags/iot'><span class="label">iot</span></a>
<a class="tag" href='../../tags/zigbee'><span class="label">zigbee</span></a>
<dt><a href="../../post/2016-09-28-tqdm/">Progress bars in python</a></dt>
<a class="tag" href='../../tags/python'><span class="label">python</span></a>
<dt><a href="../../post/2015-04-10-github-dotfiles/">Sharing dotfiles</a></dt>
<a class="tag" href='../../tags/github'><span class="label">github</span></a>
<a class="tag" href='../../tags/git'><span class="label">git</span></a>
<a class="tag" href='../../tags/dotfiles'><span class="label">dotfiles</span></a>
</div>
</div>
<div class="clear"></div>
</div>
<footer class="pagefooter" role="contentinfo">
<div class="contact">
<p>
J. Fernando Sánchez Rada | balkian
</p>
</div>
<ul id="social">
<li><a href="http://github.com/balkian"><i class="fab fa-github"></i></a></li>
<li><a href="http://lab.gsi.upm.es/balkian"><i class="fab fa-gitlab"></i></a></li>
<li><a href="http://twitter.com/balkian"><i class="fab fa-twitter"></i></a></li>
<li><a href="http://git.sinpapel.es/balkian"><i class="fab fa-git"></i></a></li>
<li><a href="http://linkedin.com/in/jfsanchezrada"><i class="fab fa-linkedin"></i></a></li>
</ul>
<p>
<i class="fab fa-creative-commons"></i> Creative Commons A-SA-NC
</p>
</footer>
</div>
<script src="../../js/jquery-2.0.2.min.js"></script>
</body>
</html>