owen243 Posted February 3, 2008 Share Posted February 3, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/89130-n00b-in-need-of-simple-website-and-apache-help/ Share on other sites More sharing options...
madmax Posted February 3, 2008 Share Posted February 3, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/89130-n00b-in-need-of-simple-website-and-apache-help/#findComment-456710 Share on other sites More sharing options...
owen243 Posted February 6, 2008 Author Share Posted February 6, 2008 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:( Quote Link to comment https://forums.phpfreaks.com/topic/89130-n00b-in-need-of-simple-website-and-apache-help/#findComment-460031 Share on other sites More sharing options...
owen243 Posted February 7, 2008 Author Share Posted February 7, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/89130-n00b-in-need-of-simple-website-and-apache-help/#findComment-461103 Share on other sites More sharing options...
owen243 Posted February 8, 2008 Author Share Posted February 8, 2008 Anyone:( Quote Link to comment https://forums.phpfreaks.com/topic/89130-n00b-in-need-of-simple-website-and-apache-help/#findComment-461805 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.