Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How hosting files with Apache [ Solved ]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
lcoulon
Tux's lil' helper
Tux's lil' helper


Joined: 25 Feb 2005
Posts: 129

PostPosted: Thu Mar 10, 2005 9:18 pm    Post subject: How hosting files with Apache [ Solved ] Reply with quote

Hello,

I need to host a list of files and let them avalaible from Internet when browsing from htpp://myaddress

For some of them i need to let people anonymous access and some others placed in a restrited area as a login & password will be resquested to access to the files ?

Can anyone explain me how to do, i'm very novice with Apache 2.
The only thing i know is that "htpasswd" needs to be generated ...


Help will be much appreciated.


Last edited by lcoulon on Sat Mar 12, 2005 2:52 pm; edited 1 time in total
Back to top
View user's profile Send private message
omnicloud
Guru
Guru


Joined: 10 Mar 2005
Posts: 542
Location: California

PostPosted: Thu Mar 10, 2005 9:25 pm    Post subject: Reply with quote

For the anonymous, just put them into a directory. For the passworded, I recommend you get some type of PHP portal and use MySQL or even a flat database file unless you just want to add a single user and give out the password to everyone. The PHP can create new users on the database , send out the email with a confirmation link if you want, you can add users easily, and it's more secure.
Back to top
View user's profile Send private message
Genone
Retired Dev
Retired Dev


Joined: 14 Mar 2003
Posts: 8993
Location: beyond the rim

PostPosted: Fri Mar 11, 2005 12:25 am    Post subject: Reply with quote

no need for a complicated and maybe insecure PHP setup, just use the builtin apache authentication as desribed in http://httpd.apache.org/docs-2.0/howto/auth.html
Back to top
View user's profile Send private message
lcoulon
Tux's lil' helper
Tux's lil' helper


Joined: 25 Feb 2005
Posts: 129

PostPosted: Fri Mar 11, 2005 7:53 am    Post subject: Reply with quote

Thanks Genone.

I have now the var/www/localhost/htdocs secured by logon / password.
( i have created .HTACCESS & .HTPASSWD files )

Then i have put all the files i want to share into var/www/localhost/htdocs folder.
However when browsing the page, i get identification window working fine but next i get this message : 8O

403 Forbidden

You don't have permission to access / on this server.
Apache/2.0.52 (Gentoo/Linux) Server at 127.0.0.1 Port 80



I need to get files list on the screen instead of 403 Error ...
I have of course no html files into the folder as i only want to host files for download.

Thanks for help.
Back to top
View user's profile Send private message
Genone
Retired Dev
Retired Dev


Joined: 14 Mar 2003
Posts: 8993
Location: beyond the rim

PostPosted: Fri Mar 11, 2005 8:25 am    Post subject: Reply with quote

Well, you've done something wrong with the config or the file permissions then, hard to say without more information.
Back to top
View user's profile Send private message
lcoulon
Tux's lil' helper
Tux's lil' helper


Joined: 25 Feb 2005
Posts: 129

PostPosted: Fri Mar 11, 2005 8:31 am    Post subject: Reply with quote

Here is attached contents of my .HTACCESS located in /var/www/locahost/htdocs:

Code:
SetEnvIfNoCase Request_URI \.ht(access|passwd)$ ban
<Files ~ "^.*$">
order allow,deny
allow from all
deny from env=ban
</Files>
Authname "Zone est restreinte:"
AuthUserFile /var/www/localhost/.htpasswd
AuthGroupFile /dev/null
AuthType Basic
<limit GET POST>
require valid-user
</limit>


And this is .HTPASSWD that is located in /var/www/localhost/ :
Code:

lcoulon:xxxxxxxxxxx



Thanks for your help.
Back to top
View user's profile Send private message
Genone
Retired Dev
Retired Dev


Joined: 14 Mar 2003
Posts: 8993
Location: beyond the rim

PostPosted: Fri Mar 11, 2005 9:24 am    Post subject: Reply with quote

looks good at a first glance. One other thing to check: are directory listings actually enabled?
Back to top
View user's profile Send private message
lcoulon
Tux's lil' helper
Tux's lil' helper


Joined: 25 Feb 2005
Posts: 129

PostPosted: Fri Mar 11, 2005 9:27 am    Post subject: Reply with quote

i don't know really as i'm very newbie with Apache, would you please tell me where i should enable this option ?
Back to top
View user's profile Send private message
Genone
Retired Dev
Retired Dev


Joined: 14 Mar 2003
Posts: 8993
Location: beyond the rim

PostPosted: Fri Mar 11, 2005 9:29 am    Post subject: Reply with quote

Being a newbie is no excuse for not looking for docs :wink:
http://httpd.apache.org/docs-2.0/mod/core.html#options
Back to top
View user's profile Send private message
lcoulon
Tux's lil' helper
Tux's lil' helper


Joined: 25 Feb 2005
Posts: 129

PostPosted: Fri Mar 11, 2005 10:41 am    Post subject: Reply with quote

I have found that i should have to add something like that :

Code:
<Directory /usr/local/httpd/htdocs>

Options Indexes FollowSymLinks

</Directory>



I added these lines in my /etc/apache2/conf/apache2.conf

Then when i try again to browse my address (no index.html) Internet Explorer still not able to list files available inside the folder.
I still getting 403 Error ...


These screens showing how i tried to enable file list from Webmin , please have a check if what i done is correct :


http://membres.lycos.fr/lcoulon1/Gentoo/screen.jpg
http://membres.lycos.fr/lcoulon1/Gentoo/screen1.jpg

Thanks for you help.
Back to top
View user's profile Send private message
lcoulon
Tux's lil' helper
Tux's lil' helper


Joined: 25 Feb 2005
Posts: 129

PostPosted: Sat Mar 12, 2005 1:08 pm    Post subject: Reply with quote

Can anybody help me regarding that problem ?
Back to top
View user's profile Send private message
Genone
Retired Dev
Retired Dev


Joined: 14 Mar 2003
Posts: 8993
Location: beyond the rim

PostPosted: Sat Mar 12, 2005 2:26 pm    Post subject: Reply with quote

Quote:
Then i have put all the files i want to share into /var/www/localhost/htdocs folder.

Quote:
I have found that i should have to add something like that :
Code:
<Directory /usr/local/httpd/htdocs>

Options Indexes FollowSymLinks

</Directory>

I added these lines in my /etc/apache2/conf/apache2.conf

You see the problem?
Back to top
View user's profile Send private message
R0Bzombie
n00b
n00b


Joined: 28 Nov 2004
Posts: 10

PostPosted: Sat Mar 12, 2005 2:39 pm    Post subject: Reply with quote

put this in your /etc/apache2/conf/commonapache2.conf

Code:
 <Directory "put the path of the folder you want to list">
     AllowOverride FileInfo AuthConfig Limit
     Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
     <Limit GET POST OPTIONS PROPFIND>
         Order allow,deny
         Allow from all
     </Limit>
     <LimitExcept GET POST OPTIONS PROPFIND>
         Order deny,allow
         Deny from all
     </LimitExcept>
 </Directory>
Back to top
View user's profile Send private message
lcoulon
Tux's lil' helper
Tux's lil' helper


Joined: 25 Feb 2005
Posts: 129

PostPosted: Sat Mar 12, 2005 2:51 pm    Post subject: Reply with quote

Thank you very much R0Bzombie , it works fine !

Would you please tell me what are options needed to be changed in Webmin to get those lines in /etc/apache2/conf/commonapache2.conf

Just to know where finding these settings in Webmin ...


Thanks again for your help! :D
Back to top
View user's profile Send private message
R0Bzombie
n00b
n00b


Joined: 28 Nov 2004
Posts: 10

PostPosted: Sat Mar 12, 2005 2:59 pm    Post subject: Reply with quote

lol a friend told me to do this and it worked and now I tell you and it's working :D don't ask me how I found this, I didn't found it
I don't even know what is webmin :wink:
Back to top
View user's profile Send private message
lcoulon
Tux's lil' helper
Tux's lil' helper


Joined: 25 Feb 2005
Posts: 129

PostPosted: Sat Mar 12, 2005 3:06 pm    Post subject: Reply with quote

No problem, anyway thanks for friend for me ! :D
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum