Jump to content

Recommended Posts

Hey

 

Im new im Mike btw :)

 

 

Right, been doing a little research and trying to widen my knowledge of web servers. So, my main task is to get apache running on a Windows machine.

 

Been reading this guide :

 

http://lifehacker.com/software/feature/how-to-set-up-a-personal-home-web-server-124212.php

 

So far, i get the part were you add a directory in the configuration line and setup the password and when you connect to the server from a Web browser....the files should be displayed.

 

 

But i now have a couple of queries which i have tried looking but i may of found the answer but have no idea how to get around it.

 

 

Ive built couple of small websites and basically, i just want a challenge, trying to setup a apache server at home, and i trying to get access to all my music files from it.

 

my main problem is... Lets say i have my index.html file.... where do i put the file, in which folder would apache need to file to display...and second... Lets say i have a hyperlink on the main page which links to my music folder. How do i put a password on the folder when opened. Like...When i click on the link, i only want me and people i want to know open the page with the username and password, but how do i set it as i don't want any other tom dick or harry opening my music library?

 

And later during my learning i will try and put Usernames and passwords for people to log in for their own spacee, such as for my gf and other mates etc. But at the moment, just the location of files and how to password protect the folders is my main question. And the my music folder HAVE to be in the folder for were i put my website in the apache directory, or could i link it to else wer. E.g: if my music folder is in C:\mymusic. . . . but the website in c:\progfiles\apache\//files//. Could i link it to the C:\mymusic or do i have to copy the music folder to the apache directory were the website files will be :(

 

I know its a bit much but any help would do

 

please :)

A lot of your questions really relate to simple HTML and web-design. There' are millions of pages you can google on this

 

However, regarding Win32 basic password access.

Open your httpd.conf file and enter the following for the example: C:\mymusic (note that FORWARD slashes MUST be used)

Done quickly from memory so fingers-crossed!

 

<Directory "C:/mymusic">
    Order Allow,Deny
    Allow from all
#Turn off .htaccess
    AllowOverride none
#Basic authentication
    AuthType Basic
    AuthName "Password For My Music"
#You need to create this file using htpasswd.exe (see below)
    AuthUserFile c:/password/htpasswd.txt
    Require user admin
#Allow my local machine with no password 
    Allow from 192.168.
#Satisfy both local machine access and password access
    Satisfy Any
</Directory>

 

You can use a handy batch file to add users

Create the folder c:\password

Copy htpasswd.exe from your Apache distro into it

Create the following batch file and call it adduser.bat

 

@echo off
echo Adding user [%1]
htpasswd.exe htpasswd.txt %1

 

Then CD into the directory in a CMD prompt and add user admin using ...

 

ADDUSER admin

 

You will be prompted for a password for admin - the results will be stored in htpasswd.txt and this file is linked-to via your <Directory> ruleset

 

The index.htm (or html) file is configured as an "index file" using the DirectoryIndex directive

 

DirectoryIndex index.htm index.html index.php

 

If such a file is found in any folder it will be used as your index page. You can configure this to be more or less anything - however this is HTML - I recommend this resource http://www.w3schools.com/

 

I also suggest you give some thought as to the design of your "folder tree". Choose a root say in "c:\wwwroot" and put sub-sites under there - such as c:\wwwroot\music  c:\wwwroot\myblog  c:\wwwroot\photographs. Avoid creating a situation where you provide access to c:\wwwroot if possible and keep that folder private. If you only have one subsite then call this say - c:\wwwroot\htdocs

and put all of your content (files and folders) UNDER there.  This advice will save you much pain later on!

 

For the example you would need to amend my music to c:\wwwroot\mymusic and the directory config would be <Directory "c:/wwwroot/mymusic">

 

Hope this helps - let me know of any bugs in the code  ;)

 

But it doesn't quite answer my Query.

 

Im going to have a .HTML page.

 

And on their a link to my music folder. When that link is clicked... it will prompt a password.

 

Although what you showed me in the code off your head it means editing the conf file which i can do that to display the files in a ftp view through a browser.

 

But i have

 

apache group\apache2.2\htdocs\index.html <- Main page

 

apache group\apache2.2\htdocs\mikesmusic <- Folder with music (Contains mp3's only)

 

Thats what im getting confused out, tried to do what you gave me, but im trying to do it through a web broser:(

Right.. i have tried everything (IMHO). I've got a .html file, loads up great. I created a link for test, and that link is linked to a folder. In the folder i have put the .htaccess file with the link to the htpasswd file. But nothing happens. The folder just opens up as  and i see the attributes inside it but no password prompt is given:(

 

helpp

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.