Login    Register
Forum rules
Set-Up GuideFAQsForum Rules
  • Author
    Message

Webserver with an indexed file directory and user login

Postby ashwix » 01 Oct 2013 08:30

Hello All,

This is my first project with NAS4Free and I have managed to do the basic setup as well as create SMB shares etc but seem to be unable to get the Webserver running as I want.

Basically I need to create a webpage "index.html" which shows a listing of files users can access by clicking on the links mentioned in that file. The files are stored in "mnt/webpool/webserver/files" I have been able to get that done. What I'm unable to do is get the user to have a log in screen show up when they access the webpage, whether locally or over the internet. I have a fixed IP Address and currently have setup the router to forward port 8000 (using this for the webserver) to the NAS. When I type the Fixed IP followed by :8000 it shows me the index.html page but no login is asked.

The configuration I used in the Webserver section is as follows :

Protocol- HTTP
Port - 8000
Run as - www
Document root - mnt/webpool/webserver/files
Upload directory - mnt/webpool/webserver/files/uploads
Authentication - Is enabled (Enable authentication.Give only local users access to the web page.) (not sure how to use this)
URL - mnt/webpool/webserver/files (not sure how to use this)
Realm - webfiles (not sure how to use this)

Directory listing - Enabled (Enable directory listing.A directory listing is generated if a directory is requested and no index-file (index.php, index.html, index.htm or default.htm) was found in that directory)

Auxiliary parameters - (not sure if I need to add something here for the log-in screen)


The user settings are :
Shell - SCPOnly
Primary Group - Public
Additional Group - Wheel
Homedirectory - /home/user1
User Portal - Checked. Grant access to user portal.


The group settings are :
Group : Public
GID:1001
Description : Common Access Folder
NewUser
ashwix
 
Posts: 4
Joined: 29 Sep 2013 08:54

Re: Webserver with an indexed file directory and user login

Postby alexey123 » 01 Oct 2013 09:33

If you not know how to use option, why you enable it? Manual for auth module

Homedirectory - /home/user1

You really have this folder?

You grant access to user portal? and give for user shell scponly? How it must work, what do you think?
where group www for user?
Lab 9.1.0.1 - Sandstorm (revision 847) / x86-embedded on HP D530 / 2G RAM / CF IDE as system
Home9.2.0.1 - Sandstorm (revision 943) / x64-embedded on SAPPHIRE Pure Mini E350 / 4G RAM
Moderator
alexey123

User avatar
 
Posts: 1306
Joined: 19 Aug 2012 06:22
Location: Israel

Re: Webserver with an indexed file directory and user login

Postby ashwix » 01 Oct 2013 10:12

Thanks for the link...I still have to figure out how to use it though.

I've been enabling/disabling the options to see if it makes a difference to the login for the users. I'm not too well versed with Unix, linux or web programming but am reading stuff online trying to do simple stuff with a NAS for home use. Though I realize that you do need to know what you are doing and for that I need to start from scratch with the basics.

Homedirectory - /home/user1 .....Well I used "user 1" for illustrative purposes maybe averagejoe would make more sense but yes I do have a folder "home.averagejoe" so to say. Made that to restrict users to their own folder when saving stuff on the NAS.

You could advise me if that's not the way it should be done then....
NewUser
ashwix
 
Posts: 4
Joined: 29 Sep 2013 08:54

Re: Webserver with an indexed file directory and user login

Postby alexey123 » 01 Oct 2013 10:25

ashwix wrote:You could advise me if that's not the way it should be done then....


Just put users directories into your storage. My users directories placed /mnt/disk/users/{user1, user2, user3,...}
For begin to study webserver, not enable auth and not give access for user's portal. Also for users login use shell nologin. In this case users cannot destroy any file into nas4free. I have only one user with shell not nologin, from group wheel.
Lab 9.1.0.1 - Sandstorm (revision 847) / x86-embedded on HP D530 / 2G RAM / CF IDE as system
Home9.2.0.1 - Sandstorm (revision 943) / x64-embedded on SAPPHIRE Pure Mini E350 / 4G RAM
Moderator
alexey123

User avatar
 
Posts: 1306
Joined: 19 Aug 2012 06:22
Location: Israel

Re: Webserver with an indexed file directory and user login

Postby ashwix » 01 Oct 2013 14:57

Yes the user directories are in "/mnt/webpool/home.averagejoe/ " as I created a pool called "webpool" and created datasets for users within them. Well the reason that the user accounts screen it shows just "Homedirectory - /home/averagejoe" I guess is because I navigated wrongly to the home directory. Have corrected that now. Its' back to"/mnt/webpool/home.averagejoe/

Thanks for the help on that but I'm still clueless about how to get a user to have a login page displayed when they type in the ipaddress followed by the port number. Thought that would be easy to do but it seems no one has an answer for that. Would appreciate it someone gave me general a step by step walk through. I have no experience with lighttpd so don't know where to put all that code.
NewUser
ashwix
 
Posts: 4
Joined: 29 Sep 2013 08:54

Re: Webserver with an indexed file directory and user login

Postby alexey123 » 01 Oct 2013 17:46

If you want authentication for users, no need more.
Then save and apply configuration. As for me - work perfect.
But, just now I find error into websever page - no need last slash into Document root
Image
If your have only first time login screen, you need destroy http session - simple close browser and open it.
On web page you can add button logout for do this without close session

UPDATE:
I attach repaired websever config page.
For full version - simple replace original services_websrv.php .
For embedded version need upload repaired services_websrv.php into storage, such /mnt/disk , then create postinit startup script
Code: Select all
cp -f /mnt/{Your}/{Location}/services_websrv.php /usr/local/www/
You do not have the required permissions to view the files attached to this post.
Last edited by alexey123 on 02 Oct 2013 11:16, edited 2 times in total.
Lab 9.1.0.1 - Sandstorm (revision 847) / x86-embedded on HP D530 / 2G RAM / CF IDE as system
Home9.2.0.1 - Sandstorm (revision 943) / x64-embedded on SAPPHIRE Pure Mini E350 / 4G RAM
Moderator
alexey123

User avatar
 
Posts: 1306
Joined: 19 Aug 2012 06:22
Location: Israel

Re: Webserver with an indexed file directory and user login

Postby ashwix » 02 Oct 2013 08:58

Hi alexey123 !!

Tried out yr instructions, it works perfectly. Who knew the slashes made all the difference but I guess that what matters with command line stuff. Thanks for your help with this. Off to figure out the code for the button now.
NewUser
ashwix
 
Posts: 4
Joined: 29 Sep 2013 08:54

Re: Webserver with an indexed file directory and user login

Postby alexey123 » 02 Oct 2013 12:32

Sorry,I cannot help you with http authentication because if I need it, I use auth over php, Example - NAS4Free webgui.
For destroy http session, you need use javascript, but test your script on all browsers - internet explorer - one script, firefox - second, chrome - third, etc.
Lab 9.1.0.1 - Sandstorm (revision 847) / x86-embedded on HP D530 / 2G RAM / CF IDE as system
Home9.2.0.1 - Sandstorm (revision 943) / x64-embedded on SAPPHIRE Pure Mini E350 / 4G RAM
Moderator
alexey123

User avatar
 
Posts: 1306
Joined: 19 Aug 2012 06:22
Location: Israel

Re: Webserver with an indexed file directory and user login

Postby Nick » 13 Nov 2013 15:32

Hi, ashwix
I have same problem as yours, could you tell me how you fix user login problem? thanks.
NewUser
Nick
 
Posts: 4
Joined: 13 Nov 2013 15:27

Re: Webserver with an indexed file directory and user login

Postby alexey123 » 14 Jan 2014 10:28

Problem solved from 9.2 version.
Lab 9.1.0.1 - Sandstorm (revision 847) / x86-embedded on HP D530 / 2G RAM / CF IDE as system
Home9.2.0.1 - Sandstorm (revision 943) / x64-embedded on SAPPHIRE Pure Mini E350 / 4G RAM
Moderator
alexey123

User avatar
 
Posts: 1306
Joined: 19 Aug 2012 06:22
Location: Israel

Return to WebServer

Who is online

Users browsing this forum: No registered users and 2 guests