You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Matus UHLAR - fantomas <uh...@fantomas.sk> on 2007/12/10 17:00:40 UTC

Re: [users@httpd] How to make a website like ftpsite?

On 30.11.07 18:21, goommy wrote:
> What my mean is not mod_ftp !!
> It's just a experiment to study apache !

please use less exclamation marks...

> What i want to do is make a website like ftpsite??after open the URL i can see the file list
> and i can download all files!

...and wrap your lines below 80 characters per line.

> First.i use "Options Indexes" and "DirectoryIndex none" list the all file!
>     By default, when i click on the file, some types can brows directly(just like *.html *.txt *.gif *.jpg ...) and some other types will prompt download dialog for choosen(like *.tar.gz *.mp3 and so on). So i want to try when click on *.html it also appear the prompt dialog for choosen! 
>     And i found ??If the media type remains unknown, the recipient SHOULD treat it as type "application/octet-stream".??on rfc2616! So i think maybe i can get the result by change the response header!!??qu.1: Is it a right idea??? 
>     So i set   <VirtualHost 125.35.14.229:80>
>     				DocumentRoot /opt/webdata/www2cn
>     				ServerName www2.putiantaili.com.cn
>     				DirectoryIndex index.none
>      				<Directory "/opt/webdata/www2cn/download-dir">
>         			#try to : all files download only ,can't browser with IE
>         			Options Indexes FollowSymLinks
>         			Header set Content-Type application/octet-stream
>         			Header append 123-Type 123
>         			AllowOverride All
>         			Order deny,allow
>         			allow from all
>     				</Directory>
> 			   </VirtualHost>
> But the result is failure! ??very depressed!!?? 
> And the reponse header is : 
> HTTP/1.0 200 OK
> Server: Apache/2.2.4 (Unix) mod_ssl/2.2.4 OpenSSL/0.9.7a
> ETag: "97b7d-2d-75d78680"
> Accept-Ranges: bytes
> Content-Type: text/plain     (why not application/octet-stream)
> 123-Type: 123 				 (123-type header set )

Try using "Content-Disposition: attachment" instead of changing
"Content-Type". 

> And qu.2 : How to make a website like ftpsite?  Thank you for your help!!!
> (This experiment takes me a long time and halt)

"website like ftpsite"? That tells nothing. What do you mean?

-- 
Matus UHLAR - fantomas, uhlar@fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
LSD will make your ECS screen display 16.7 million colors

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] How to make a website like ftpsite?

Posted by so...@apache.org.
On 12/10/07, Matus UHLAR - fantomas <uh...@fantomas.sk> wrote:
> On 30.11.07 18:21, goommy wrote:
> > What i want to do is make a website like ftpsite??after open the URL i can see the file list
> > and i can download all files!
>
> > First.i use "Options Indexes" and "DirectoryIndex none" list the all file!
> >     By default, when i click on the file, some types can brows directly(just like *.html *.txt *.gif *.jpg ...) and some other types will prompt download dialog for choosen(like *.tar.gz *.mp3 and so on). So i want to try when click on *.html it also appear the prompt dialog for choosen!
> >     And i found ??If the media type remains unknown, the recipient SHOULD treat it as type "application/octet-stream".??on rfc2616! So i think maybe i can get the result by change the response header!!??qu.1: Is it a right idea???
> >     So i set   <VirtualHost 125.35.14.229:80>
> >                               DocumentRoot /opt/webdata/www2cn
> >                               ServerName www2.putiantaili.com.cn
> >                               DirectoryIndex index.none
> >                               <Directory "/opt/webdata/www2cn/download-dir">
> >                               #try to : all files download only ,can't browser with IE
> >                               Options Indexes FollowSymLinks
> >                               Header set Content-Type application/octet-stream
> >                               Header append 123-Type 123
> >                               AllowOverride All
> >                               Order deny,allow
> >                               allow from all
> >                               </Directory>
> >                          </VirtualHost>
> > But the result is failure! ??very depressed!!??
> > And the reponse header is :
> > HTTP/1.0 200 OK
> > Server: Apache/2.2.4 (Unix) mod_ssl/2.2.4 OpenSSL/0.9.7a
> > ETag: "97b7d-2d-75d78680"
> > Accept-Ranges: bytes
> > Content-Type: text/plain     (why not application/octet-stream)
> > 123-Type: 123                                  (123-type header set )
>
> Try using "Content-Disposition: attachment" instead of changing
> "Content-Type".
> "website like ftpsite"? That tells nothing. What do you mean?

The OP wants to display the contents of a directory as a list of files
"like an FTP server".  Options Indexes will do that if no index.html
file exists in the specified directory.
The OP added many extra lines of configuration and managed to break it.

From:  http://httpd.apache.org/docs/2.2/mod/core.html#options
 <Directory /web/docs>
Options Indexes FollowSymLinks
</Directory>

The name of the directory should not be in quotes.  Requires
mod_autoindex.  Delete the extra configuration.

I have not tried Directory elements inside VirtualHosts.  The
documentation implies that is valid.  Test using the main host; worry
about the virtual host after proving your configuration is correct for
the main host.

HTH,
solprovider

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org