Publicly Accessible Folder Over HTTP?

Questions about hosting a Website, using MySQL and PhP may be posted here.
Forum rules
This is a user forum for Synology users to share experience/help out each other: if you need direct assistance from the Synology technical support team, please use the following form:
https://myds.synology.com/support/suppo ... p?lang=enu

Publicly Accessible Folder Over HTTP?

Postby Jiriteach » Tue Mar 13, 2012 3:55 am

Hi There,

Does anyone know if its possible to set a folder to be publicly accessible via HTTP?
Example: Drop a file into a shared folder called "Public"

This file is then accessible by browsing to:

http://servername/public? Or something similar with directory browsing enabled AND without being prompted for a username and password?

How does one set this up in DSM 4.0?

Cheers
Jiriteach
I'm New!
I'm New!
 
Posts: 5
Joined: Sun Nov 27, 2011 10:15 am

Re: Publicly Accessible Folder Over HTTP?

Postby Jiriteach » Mon Jun 04, 2012 11:24 am

Hi There,

Does anyone know how to do this?

Cheers
Jiriteach
I'm New!
I'm New!
 
Posts: 5
Joined: Sun Nov 27, 2011 10:15 am

Re: Publicly Accessible Folder Over HTTP?

Postby myCloud » Mon Jun 04, 2012 11:36 am

Assuming you have Web Services running, create a folder in /volume1/web named public and put the file(s) in there. Unless you put a deny all to all robots.txt at the root of /volume1/web, Google and all the other search engines will index it and return links to it in searches.
DS 1512+ w/3GB, 5 x 3TB Seagate ST3000DM001 8.2TB RAID 6, half files/half Time Machine.
Icy Dock MB559U3S-1SB enclosure w/4TB Hitachi UltraStar via USB 3 for files backup
UVERSE to AirPort Extreme + 2 AirPort Express w/speakers. TRENDnet TV-IP312WN camera
CyberPower CP1500PFCLCD Sine Wave UPS
DSM 4.1-2661 w/SSH + SFTP, VPN Server, Syslog Server, Media Server, Mail Server, Mail Station,
Audio Station, Surveillance Station, Photo Station, Web Station - DS Apps on iPad & iPod Touch.
User avatar
myCloud
Skilled
Skilled
 
Posts: 648
Joined: Fri Mar 23, 2012 11:28 am

Re: Publicly Accessible Folder Over HTTP?

Postby axj » Mon Jun 04, 2012 12:00 pm

Another possibility is to use FileZilla (maybe others). I have created several folders at the same level as music, photo and web like public, f-data and others and have full access to them. It looks like an advanced pathfinder. About the same can be done with 'My WebDav' if you are using an IPad3 (the interface is familiar to FileZilla).
DS509+ 4*1TB Raid+1TB DSM 4.0-2219. Logitech BOOM+Duet 7.6.1, WebCam: Linksys WVC54GCA + TrendNet TV-IP121
DS212+ 1TB & D-Link DIR-685, HP C7280, Dell 3100cn. iPad3, Programming Pascal, Clarion 5.5, html/php. http://axj.dk
User avatar
axj
Specialist
Specialist
 
Posts: 1058
Joined: Fri Jan 02, 2009 10:59 am
Location: Esbjerg, Danmark

Re: Publicly Accessible Folder Over HTTP?

Postby Goner » Mon Jun 04, 2012 12:05 pm

If you only put files like *.jpg or *.txt in the /public folder, nothing will show up as HTTP only works with files like index.html or index.php

I found this after some Googling :

Code: Select all
<?php

$dir="."; // Directory where files are stored

if ($dir_list = opendir($dir))
{
while(($filename = readdir($dir_list)) !== false)
{
?>
<p><a href="<?php echo $filename; ?>"><?php echo $filename;
?></a></p>
<?php
}
closedir($dir_list);
}

?>


the code needs some cleaning up as the order in which the files are shown is not correct, but if you save the code as index.php in /public it will show all files in the folder (including itself) so you can right-click them and do 'save as ...'
(dir="." points to itself)

You could also produce a directory listing with .htaccess file for Apache
Last edited by Goner on Mon Jun 04, 2012 12:12 pm, edited 1 time in total.

NAS : DS212j with 2 ST2000DL003 in SHR / DSM 4.2-3211
LAN : Fritz!Box 7170, 4 Devolo, 1 Icidu 200Mbps AV homeplugs, 2 5-port switches
HW : Conceptronic CHD3NET, ACRyan Playon!HD, Eminent EM7075dts, Wii U, PS2
User avatar
Goner
Enlightened
Enlightened
 
Posts: 443
Joined: Tue Mar 06, 2012 2:27 pm
Location: Rotterdam, Netherlands

Re: Publicly Accessible Folder Over HTTP?

Postby myCloud » Mon Jun 04, 2012 12:11 pm

You can link to files in /volume1/web/public without having to publish a public directory listing. I have directories by subject under web with files I link to in forum posts, emails, etc.
DS 1512+ w/3GB, 5 x 3TB Seagate ST3000DM001 8.2TB RAID 6, half files/half Time Machine.
Icy Dock MB559U3S-1SB enclosure w/4TB Hitachi UltraStar via USB 3 for files backup
UVERSE to AirPort Extreme + 2 AirPort Express w/speakers. TRENDnet TV-IP312WN camera
CyberPower CP1500PFCLCD Sine Wave UPS
DSM 4.1-2661 w/SSH + SFTP, VPN Server, Syslog Server, Media Server, Mail Server, Mail Station,
Audio Station, Surveillance Station, Photo Station, Web Station - DS Apps on iPad & iPod Touch.
User avatar
myCloud
Skilled
Skilled
 
Posts: 648
Joined: Fri Mar 23, 2012 11:28 am

Re: Publicly Accessible Folder Over HTTP?

Postby animator » Sat Jun 09, 2012 8:58 am

If you wanna share directories that are not in the web directory and dont want to transfer all the files from there, it can be done by using bind mounts.

Example:
I have a folder called Music which I stored in the folder /public, so the path is /public/Music/

Now i will create a directory in /web with the same name (doesnt have to be the same) so the path in web folder is /web/Music/

Now we need to use ssh or telnet. And write this command:

Code: Select all
mount --bind /volume1/public/Music /volume1/web/Music

(I have only 1-rack NAS server not sure how the /volume mount point looks like on more rack servers.)

Now we have made a bind between these folders so the folder in /web/Music/ is now pointing to the directory /public/Music/ and is accessible through the web http://domain or ip/Music/

This is also a way I have forced FTP users to have access to the right folders.
animator
Trainee
Trainee
 
Posts: 17
Joined: Fri Jun 08, 2012 10:42 am

Re: Publicly Accessible Folder Over HTTP?

Postby Leonmeijer » Mon Jun 18, 2012 8:01 am

You can also modify the open_basedir setting by including the public folder path. Then use a PHP script to list / get the files from that folder.
Leonmeijer
Rookie
Rookie
 
Posts: 32
Joined: Wed May 16, 2012 11:58 am


Return to Web Server + PHP / MySQL

Who is online

Users browsing this forum: No registered users and 3 guests