Difference between revisions of "Enable WebDAV"

From AwkwardTV
Jump to: navigation, search
(New page: Chasd: If you need access to all platforms, WebDAV is cross platform, unlike AFP or CIFS. Since someone has been able to get Apache to run, I would like to see some try to enable WebDAV. T...)
 
(Major Clean Up)
Line 1: Line 1:
Chasd: If you need access to all platforms, WebDAV is cross platform, unlike AFP or CIFS. Since someone has been able to get Apache to run, I would like to see some try to enable WebDAV. To enable WebDAV, uncommenting the config file line that loads the dav_module, and also the line that adds mod_dav.c. Then set up Directives that create an alias and enable WebDAV, like this :
+
WebDAV is supported by default in both Mac and Windows. So, it will be easier to set up in a heterogeneous environment than an [[Enable_AFP_Server|AFP]] or [[Enable_FTP_Server|FTP]] server.
  
Inside the
+
== Install Apache ==
  
<pre><IfModule mod_alias.c>
+
I won't repeat what has already been said here: http://www.appletvhacks.net/2007/03/25/apache-running-on-apple-tv/
[...]
 
</IfModule></pre>
 
  
block, add this block, generally after the block of lines for CGI-
+
== Configure Apache ==
  
<pre><IfModule mod_dav.c>
+
Copy and paste the following to have it added to the end of the Apache configuration file:
Alias /media "/mediadirectorypath/"
 
  
# Create a lock database file for this server at this path
+
<pre>sudo -s
DAVLockDB /Library/Webserver/DAVLock.ical
+
 
# Minimum life of a lock
+
cat <<EOT >> /etc/httpd/httpd.conf 
DAVMinTimeout 600
+
<IfModule mod_dav.c>
<Directory /mediadirectorypath>
+
    DAVLockDB /Library/WebServer/DAVDB/Lock.db
DAV On
+
    DAVMinTimeout 600
AllowOverride None
+
 
Options None
+
    Alias /media "/Users/frontrow/Movies/"
allow from all
+
    <Directory "/Users/frontrow/Movies/">
</Directory>
+
        DAV On
 +
        Allow From all
 +
    </Directory>  
 
</IfModule>
 
</IfModule>
 +
EOT
 
</pre>
 
</pre>
  
Make sure the media directory is writable by the apache process.
+
== Set up Lock Database ==
You may need to touch the lock file and set its permissions.
+
 
 +
WebDAV requires a database file to track file locks. Simply copy and paste commands to get that set up:
 +
 
 +
<pre>mkdir /Library/WebServer/DAVDB
 +
chown www:admin /Library/WebServer/DAVDB
 +
touch /Library/WebServer/DAVDB/Lock.db
 +
chown www:admin /Library/WebServer/DAVDB/Lock.db</pre>
 +
 
 +
== Set up Permissions ==
 +
 
 +
Since Apache runs as the www user, you'll need to give write access to the folder you're uploading files to.  
 +
 
 +
<pre>chmod 777 /Users/frontrow/Movies</pre>
 +
 
 +
== Restart Apache and Connect ==
 +
 
 +
Now just restart Apache to pick up the changes
 +
 
 +
<pre>apachectl restart</pre>
  
Restart apache, then use this URL in "Connect To Server"
+
And connect with the URL <nowiki>http://IPADDRESS/media/</nowiki> and that should be all there is to it.
  
<nowiki>http://<ipaddressofappletv/media/</nowiki>
+
<font color=red>Be warned that this opens up WebDAV without any restrictions on who can connect or any password protection! Do not follow these exact instructions if your AppleTV is accessible outside your network, or if your network is not trusted!</font> You can look at basic Allow/Deny directives in Apache, or setting up password protection. There are numerous guides out there.

Revision as of 20:53, 18 April 2007

WebDAV is supported by default in both Mac and Windows. So, it will be easier to set up in a heterogeneous environment than an AFP or FTP server.

Install Apache

I won't repeat what has already been said here: http://www.appletvhacks.net/2007/03/25/apache-running-on-apple-tv/

Configure Apache

Copy and paste the following to have it added to the end of the Apache configuration file:

sudo -s

cat <<EOT >> /etc/httpd/httpd.conf   
<IfModule mod_dav.c>
    DAVLockDB /Library/WebServer/DAVDB/Lock.db
    DAVMinTimeout 600

    Alias /media "/Users/frontrow/Movies/"
    <Directory "/Users/frontrow/Movies/">
        DAV On
        Allow From all
    </Directory>    
</IfModule>
EOT

Set up Lock Database

WebDAV requires a database file to track file locks. Simply copy and paste commands to get that set up:

mkdir /Library/WebServer/DAVDB
chown www:admin /Library/WebServer/DAVDB
touch /Library/WebServer/DAVDB/Lock.db
chown www:admin /Library/WebServer/DAVDB/Lock.db

Set up Permissions

Since Apache runs as the www user, you'll need to give write access to the folder you're uploading files to.

chmod 777 /Users/frontrow/Movies

Restart Apache and Connect

Now just restart Apache to pick up the changes

apachectl restart

And connect with the URL http://IPADDRESS/media/ and that should be all there is to it.

Be warned that this opens up WebDAV without any restrictions on who can connect or any password protection! Do not follow these exact instructions if your AppleTV is accessible outside your network, or if your network is not trusted! You can look at basic Allow/Deny directives in Apache, or setting up password protection. There are numerous guides out there.