Ubuntu apache php PirateBox

Posted by idoxlr8 
This forum is currently read only. You can not log in or make any changes. This is a temporary situation.
Now, this forum is in read-only mode. You find details Details hereContinue on /r/PirateBox
Ubuntu apache php PirateBox
January 23, 2013 08:03AM
First off, PirateBox is great. I see myself using it on several small units in the future.
Now though, I live in a place where everybody wants to "watch stuff" but do not have the means....
I have a full blown server quad core 16gigs ddr3 and many terrabytes of files to share.
I find that The laptop version, full install is very slow to serve up custom pages ie: index.html with images.
Heck, the landing page with the logo is slow but, I can dl a file via wireless from PirateBox at 2.2megs...
I have not installed php or apache... yet

What I'm looking for is a solution like PirateBox for a server like mine. Apache, php, mysql...The works...
Any links? Any ideas?

Thanks
Re: Ubuntu apache php PirateBox
January 23, 2013 09:15AM
Hi,
you are using the scriptpackage with the 2 python scripts running, correct?

Have a look at my repository:
I'm currently reworking the tutorial for this: [piratebox.aod-rpg.de]

This package uses lighttpd and may perform much faster than the old python script based stuff smiling smiley

Matthias
Re: Ubuntu apache php PirateBox
January 23, 2013 06:17PM
Thanks Matthias

I will give this a go this afternoon and let you know how it works out
Re: Ubuntu apache php PirateBox
January 24, 2013 04:28PM
Matthias,

I got my box running Xfce and the scripts from the repository.

Is working way better that what I had before.
Still working on the php issues.
I noticed that Windows 7 has a problem with connecting...
So I did some research into hostapd.conf, this is what I did:
Language: PHP
##### hostapd configuration file ############################################## # Empty lines and lines starting with # are ignored # AP netdevice name (without ';ap'; postfix, i.e., wlan0 uses wlan0ap for # management frames); ath0 for madwifi interface=wlan0   driver=nl80211   # hostapd event logger configuration # Levels (minimum value for logged events): # 0 = verbose debugging # 1 = debugging # 2 = informational messages # 3 = notification # 4 = warning # logger_syslog=-1 logger_syslog_level=2 logger_stdout=-1 logger_stdout_level=2   # Dump file for state information (on SIGUSR1) dump_file=/tmp/hostapd.dump   ##### IEEE 802.11 related configuration ####################################### # SSID to be used in IEEE 802.11 management frames ssid=PirateBox Free   # Operation mode (a = IEEE 802.11a, b = IEEE 802.11b, g = IEEE 802.11g, # Default: IEEE 802.11b hw_mode=g   # Channel number (IEEE 802.11) # (default: 0, i.e., not set, used with channel_policy=2) channel=1   # Beacon interval in kus (1.024 ms) (default: 100; range 15..65535) beacon_int=100   # DTIM (delivery trafic information message) period (range 1..255): # number of beacons between DTIMs (1 = every beacon includes DTIM element) # (default: 2) dtim_period=2   # Maximum number of stations allowed in station table. New stations will be # rejected after the station table is full. IEEE 802.11 has a limit of 2007 # different association IDs, so this number should not be larger than that. # (default: 2007) max_num_sta=255   # RTS/CTS threshold; 2347 = disabled (default); range 0..2347 # If this field is not included in hostapd.conf, hostapd will not control # RTS threshold and ';iwconfig wlan# rts <val>'; can be used to set it. rts_threshold=2347   # Fragmentation threshold; 2346 = disabled (default); range 256..2346 # If this field is not included in hostapd.conf, hostapd will not control # fragmentation threshold and ';iwconfig wlan# frag <val>'; can be used to set # it. fragm_threshold=2346   ##### IEEE 802.1X-2004 related configuration ################################## # Require IEEE 802.1X authorization ieee8021x=0 ##### WPA/IEEE 802.11i configuration ########################################## # Enable WPA. Setting this variable configures the AP to require WPA (either # WPA-PSK or WPA-RADIUS/EAP based on other configuration). For WPA-PSK, either # wpa_psk or wpa_passphrase must be set and wpa_key_mgmt must include WPA-PSK. # For WPA-RADIUS/EAP, ieee8021x must be set (but without dynamic WEP keys), # RADIUS authentication server must be configured, and WPA-EAP must be included # in wpa_key_mgmt. # This field is a bit field that can be used to enable WPA (IEEE 802.11i/D3.0) # and/or WPA2 (full IEEE 802.11i/RSN): # bit0 = WPA # bit1 = IEEE 802.11i/RSN (WPA2) (dot11RSNAEnabled) wpa=0   device_name=PirateBox Free # Friendly Name (required for UPnP) # Short description for end use. Should be less than 64 characters. friendly_name=PirateBox Free
I was thinking that maybe if I used wpa and gave the password out in the ssid that might help?
What do you think?
Re: Ubuntu apache php PirateBox
January 24, 2013 05:17PM
Nice to hear smiling smiley

>> Still working on the php issues.
which issues? I have some experience with lighttpd+php from building another package.

>> I noticed that Windows 7 has a problem with connecting...
Can you describe the windows7 issues a bit more? Did you try it with a static ip to exclude DHCP issues?
I haven't any trouble with my Windows7 Notebook.



Edited 1 time(s). Last edit at 01/24/2013 05:18PM by Matthias.
Re: Ubuntu apache php PirateBox
January 24, 2013 05:35PM
My laptop with Win 7 throws up warning saying that additional info may be need, and to click to open in browser and it's very slow connecting.
I think I have it figured out.
Take a look here:
http://blog.superuser.com/2011/05/16/windows-7-network-awareness/
I think it's because win 7 detects no internet... maybe a hosts hack and the mentioned txt file.
I setup a subdomain on my server and changed the registry settings and it took care of the issue but, we cant expect that from users that connect to PirateBox...

The php issues are simple... after installation... what files to change to get it to work...

Thanks



Edited 1 time(s). Last edit at 01/24/2013 05:36PM by idoxlr8.
Re: Ubuntu apache php PirateBox
January 24, 2013 05:42PM
How funny...
Now that I take a look in the hosts file, I see you have been down this road before...
# Entry for tricking windows
Re: Ubuntu apache php PirateBox
January 24, 2013 06:43PM
yes. but do not uncomment the entry, because the IP adress is not available at the PirateBox network. The default redirection will overtake and give the IP of your Piratebox.
On the PirateBox webserver, windows tries to download ncsi.txt file. If this is available, the internet-detection should be the opinion everything is ok.
Re: Ubuntu apache php PirateBox
January 24, 2013 06:54PM
I actually noticed something similar, I work IT with Win7 and we have a DMZ network that acts very similarly to PirateBox and I have come across this before, I think it has something to do with Win7 thinking that the page is a login page for something like a hotel. Is your windows 7 machine using the network manager provided by Windows or is it using one from Dell, HP, or who ever manufactures your laptop? Some proprietary network managers will cause some major issues with non-stock wireless configurations, like it may be thinking you are trying to authenticate to the network (802.1x standard using either PEAP, LEAP, etc.) which can support a open wireless network, which could literally just be confusing the manager.
Re: Ubuntu apache php PirateBox
January 24, 2013 07:01PM
Thats the problen here, it's not getting the ncsi.txt file from PirateBox...
Yea, I left them commented out.
I was thinking about maybe adding:
www.msftncsi.com 127.0.0.1

will mess with it some more...

Thanks again...
Re: Ubuntu apache php PirateBox
January 24, 2013 07:27PM
127.0.0.1 would not be correct

try <your piratebox ip here> .. 192.168.77.1 (on debian-scripts)
Re: Ubuntu apache php PirateBox
January 24, 2013 10:50PM
Had to jump to another project for awhile...
Now I'm back to playing...
Tried both local ip addresses and it seems that neither are sending the txt file.

The PirateBox ip and 127.0.0.1 are the same...
Have you ever fired up your browser (On the PirateBox) and pointed it to 127.0.0.1 while PirateBox is running?
It all works except the chat feature...2

@TerrorByte... That was a good suggestion.
But didd'nt see a difference...

Still having issues with php...
I don't have opkg so tried apt-get, really screwed things up
Cant run lighttpd because port 80 already open, had to uninstall...again
Re: Ubuntu apache php PirateBox
January 25, 2013 06:42AM
during the install of lighttpd it is started and enabled for bootup on default.

Watch this page: [piratebox.aod-rpg.de]

You have to run:

/etc/init.d/lighttpd stop
 update-rc.d lighttpd remove

If there is a lighttpd already running, that's the reason why this file can't be found. If the install-default lighttpd is started, it points to another directory

127.0.0.1 can't be right! Is your Ubuntu your windows7 machine? no. If you enter the entry with 127.0.0.1 in your hosts file, the windows maschine get the IP 127.0.0.1 if it asks for www.....



Edited 1 time(s). Last edit at 01/25/2013 06:44AM by Matthias.
Re: Ubuntu apache php PirateBox
January 26, 2013 07:46AM
Thanks Guys, for all of your support.
I have forked The PirateBox Project using your help and assistance.
I guess I need to document it somewhere so that others can contribute.

This is what I did...
I have an extensive lan here at the house... a dozen pc's including all my xbmc boxes and several servers.
I had an old Linksys wrt54gs router with ddwrt on it.
I configured the Linksys only as far as setting up the Additional DNSMasq Options and the Hotspot HTTP Redirect settings

I now have my old Linksys pointing to my dev server and all seems to be good...So Far...
I did have to write a .htaccess file for the redirect and made some simple php dir listing scripts so that phone users can logon...
Pretty much... It's been a learning experience...

I would like to document this for others if you guys approve... Give me a place and I will do...
Thanks

Tim - idoxlr8 (I do accelerate)
Re: Ubuntu apache php PirateBox
January 26, 2013 08:53AM
sorry Matthias...
...
Been busy...
tired, old and... tired...
127.0.0.1 is always home...
it works for me...
I got all my test laptops to grab the fake file...
Maybe i can post my settings...
Re: Ubuntu apache php PirateBox
March 31, 2013 03:31PM
Hello idoxlr8,
thx for all the informations in this thread.
Did you document what you did somewhere ?

I'm working on something a bit similar (if I'm not wrong),
trying to install PB or PB-like on an ordinary PC under Debian
in order to make available by wifi some more "usual" websites.
(and not just a single homepage).
Thx
Vincent

--
Vincent, France, trying to install a PB, or PB-like, on a standard PC with Debian.
[entrepierres.net]
Re: Ubuntu apache php PirateBox
March 31, 2013 03:46PM
I am working on another project right now but, this afternoon i will see if I can post exactly what I did.
.htaccess: - This makes sure that you get redirected...
######### Error Documents
ErrorDocument 404 /errors/404.php
ErrorDocument 403 /errors/404.php
ErrorDocument 500 /errors/404.php
######## End Error Documents
error page 404.php: - the actual redirection
Language: PHP
<?php   header( ';Location: http://192.168.1.105'; ) ;   ?>
In each folder...movie...series... index.php:
Language: PHP
<FORM><INPUT TYPE="BUTTON" VALUE="Go Back" ONCLICK="history.go(-1)"></FORM> <?php echo ';<div style="overflow: hidden;" class="scroll-x tiles">';; echo ';<ul>';; function listFolderFiles($dir,$exclude){ $ffs = scandir($dir); //echo ';<div>';;   foreach($ffs as $ff){ if(is_array($exclude) and !in_array($ff,$exclude)){ if($ff != ';.'; && $ff != ';..';&& strtolower(substr($ff, -4)) != ".jpg"){ if(!is_dir($dir.';/';.$ff)){ //This shows the main links to the files echo ';<li><a target="_blank" href="';.ltrim($dir.';/';.$ff,';./';).';">';.$ff.';</a>';; //this shows the folder images/// //echo ';<li><a href="';.ltrim($dir.';/';.$ff,';./';).';"><img src="';.ltrim($dir.';./';).';folder.jpg"/></a></li>';; } else { // This shows the folders/// //echo ';<li>';.$ff.';</li>';; } ///Main listing - this is what displays the links if(is_dir($dir.';/';.$ff)) listFolderFiles($dir.';/';.$ff,$exclude);   } } } //echo ';</ul>';;   }   listFolderFiles(';.';,array(';Thumbs.db';,';index.php';,';src';,';1 - New';)); echo ';</ul>';; echo ';</div>';; ?>
I will have to fire up the router and get the code/settings from there.
I will try to do it later today