81 lines
2.7 KiB
HTML
81 lines
2.7 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml"><head>
|
|
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<link rel="stylesheet" href="main.css" type="text/css" />
|
|
<link rel="stylesheet" href="blog.css" type="text/css" />
|
|
<link rel="alternate" type="application/rss+xml" title="Subscribe to this page..." href="feed.rss" />
|
|
<title>Nginx as a file server</title>
|
|
</head><body>
|
|
<div id="divbodyholder">
|
|
<div class="headerholder"><div class="header">
|
|
<div id="title">
|
|
<h1 class="nomargin"><a class="ablack" href="http://zigford.org/index.html">zigford.org</a></h1>
|
|
<div id="description"><a href="about.html">About</a><a href="links.html"> | Links</a><a href="scripts.html"> | Scripts</a><br>Sharing linux/windows scripts and tips</br></div>
|
|
</div></div></div>
|
|
<div id="divbody"><div class="content">
|
|
<!-- entry begin -->
|
|
<h3><a class="ablack" href="nginx-as-a-file-server.html">
|
|
Nginx as a file server
|
|
</a></h3>
|
|
<!-- bashblog_timestamp: #201904212230.52# -->
|
|
<div class="subtitle">April 21, 2019 —
|
|
Jesse Harris
|
|
</div>
|
|
<!-- text begin -->
|
|
<p>FTP, SMB, SSH, HTTP... The list goes on.</p>
|
|
<p>There are many ways to serve files. Here is a quick note of how I edited the
|
|
default raspbian nginx conf files to enable a simple directory with browsing to
|
|
be served from a raspberry pi</p>
|
|
<hr />
|
|
<ol>
|
|
<li>
|
|
<p>Install nginx-light</p>
|
|
<pre><code>sudo apt-get install nginx-light -y
|
|
</code></pre>
|
|
</li>
|
|
<li>
|
|
<p>Make sure group <code>other</code> has x permissions all the way up the tree to where
|
|
content will be served from. <em>Security warning</em> I recommend only doing this
|
|
on an internally facing pi.</p>
|
|
<pre><code>sudo chmod o+x /media /media/JesseHD /media/JesseHD/Movies
|
|
</code></pre>
|
|
</li>
|
|
<li>
|
|
<p>Edit `/etc/nginx/sites-available/default, uncomment the last server section</p>
|
|
<pre><code>server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
|
|
server_name 192.168.178.88;
|
|
|
|
root /media/JesseHD/Movies;
|
|
autoindex on;
|
|
|
|
}
|
|
</code></pre>
|
|
</li>
|
|
<li>
|
|
<p>Restart nginx</p>
|
|
<pre><code>sudo systemctl restart nginx
|
|
</code></pre>
|
|
</li>
|
|
</ol>
|
|
<p>Tags: <a href='tag_raspberry-pi.html'>raspberry-pi</a>, <a href='tag_nginx.html'>nginx</a></p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- text end -->
|
|
<!-- entry end -->
|
|
</div>
|
|
<div id="footer">© <a href="http://twitter.com/zigford_org">Jesse Harris</a> — <a href="mailto:jesse@zigford.org">jesse@zigford.org</a><br/>
|
|
Generated with <a href="https://github.com/cfenollosa/bashblog">bashblog</a>, a single bash script to easily create blogs like this one</div>
|
|
</div></div>
|
|
</body></html>
|