Running piratebox with apache instead of lighttpd

Posted by Mr_izmir 
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
Running piratebox with apache instead of lighttpd
December 30, 2014 04:17PM
I'm trying to run piratebox with apache for couple of weeks. I have gotten great help from Matthias on IRC support. And need more smiling smiley

I try to hide the port number on my browser in this process of my project. Hope i understood correctly your words Matthias smiling smiley

I applied these to my piratebox

I've added this line on end of this file: /opt/piratebox/conf/lighttpd/lighttpd.conf
echo 'server.bind = "192.168.77.1"

I've added this line on end of this file: /opt/piratebox/conf/hosts
echo "www.$HOST $NET.2"

I've changed this line in this file as: /etc/apache2/ports.conf
Listen 80 ----->
Listen 192.168.77.2:80
Listen 127.0.0.1:80

And put this lines in this file: /opt/piratebox/bin/hooks/hook_piratebox_start_done.sh

echo '

if [ ! -f $1 ] ; then
echo "Config-File $1 not found..."
exit 255
fi

#Load config
. $1

ifconfig "$INTERFACE":0 $NET.2 up

/etc/init.d/apache restart

'


But I don't know whether I've missed something . Beacuse i can't access web pages of apace and lighttpd through browser now...any idea for solving the problem?

Thank you for all answers from now on



Edited 1 time(s). Last edit at 12/30/2014 04:22PM by Mr_izmir.
Re: Running piratebox with apache instead of lighttpd
January 01, 2015 05:22PM
can you please post a copy of the files

/opt/piratebox/bin/hooks/hook_piratebox_start_done.sh
/opt/piratebox/conf/hosts
/opt/piratebox/conf/lighttpd/lighttpd.conf
/etc/apache2/ports.conf
/opt/piratebox/conf/lighttpd/lighttpd.conf

and

/opt/piratebox/tmp/error.log

which IP do you access for testing?


This is only my signature.
Re: Running piratebox with apache instead of lighttpd
January 03, 2015 07:39AM
There is no error.log file in /opt/piratebox/tmp, I have tested pages on 192.168.77.1, 192.168.77.2, 127.0.0.1 etc. I couldn't instert files on my post that's why i'll copy and paste codes in here:

/opt/piratebox/bin/hooks/hook_piratebox_start_done.sh

echo '

if [ ! -f $1 ] ; then
echo "Config-File $1 not found..."
exit 255
fi

#Load config
. $1

ifconfig "$INTERFACE":0 $NET.2 up

/etc/init.d/apache restart

'

/opt/piratebox/conf/hosts

#------ Static
. /opt/piratebox/conf/piratebox.conf
echo "www.$HOST $NET.2" >> /opt/piratebox/conf/hosts
# Entry for tricking windows
### commented because this will cause the default redirect.
### left here for documentary the stuff
### dns.msftncsi.com 131.107.255.255
#------- Static end ... Generated stuff now

/opt/piratebox/conf/lighttpd/lighttpd.conf

## Configuration for Piratebox

server.modules = (
# "mod_access", not needed!
# "mod_alias",
# "mod_compress", Disabled, fixing reload Problem??
"mod_redirect",
# "mod_rewrite",
"mod_setenv",
)

server.document-root = "/opt/piratebox/www"
server.upload-dirs = ( "/opt/piratebox/share/tmp" )
server.errorlog = "/opt/piratebox/tmp/error.log"
server.breakagelog = "/opt/piratebox/tmp/break.log"
server.pid-file = "/opt/piratebox/tmp/lighttpd.pid"

server.username = "nobody"
server.groupname = "nogroup"



index-file.names = ( "index.php", "index.html",
"index.htm", "default.htm",
" index.lighttpd.html" )

url.access-deny = ( "~", ".inc" )

# added .cgi .py
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" , ".cgi" , ".py" )

#include_shell "/usr/share/lighttpd/use-ipv6.pl"

dir-listing.encoding = "utf-8"
server.dir-listing = "enable"

# Grabs main css
dir-listing.external-css = "/style.css"

# Header
# Enables header section
dir-listing.show-header = "enable"
dir-listing.encode-header = "disable"
# Hides HEADER.txt from listing
dir-listing.hide-header-file = "enable"

# Footer
# Enables footer section
dir-listing.show-readme = "enable"
dir-listing.encode-readme = "disable"
# Hides README.txt from listing
dir-listing.hide-readme-file = "enable"
# Diables default footer text
dir-listing.set-footer = " "

# Disabled, maybe fixes reload problem on imageboard
#compress.cache-dir = "/var/cache/lighttpd/compress/"
#compress.filetype = ( "application/x-javascript", "text/css", "text/html", "text/plain" )

#n.a. on router include_shell "/usr/share/lighttpd/create-mime.assign.pl"
include "/opt/piratebox/conf/lighttpd/mime.types"

#----------- ShoutBox-Env --------------
include "/opt/piratebox/conf/lighttpd/env"

#----------- cgi.conf --------------
server.modules += ( "mod_cgi" )

$HTTP["url"] =~ "^/cgi-bin/" {
# cgi.assign = ( "" => "" )
cgi.assign = ( ".py" => "/usr/bin/python" )
}

## Warning this represents a security risk, as it allow to execute any file
## with a .pl/.py even outside of /usr/lib/cgi-bin.
#
#cgi.assign = (
# ".pl" => "/usr/bin/perl",
# ".py" => "/usr/bin/python",
#)

$HTTP["url"] =~ "^/board/" {
cgi.assign = ( ".pl" => "/usr/bin/perl" , )
}
#-------------------------------------



# 404 Error Page with redirect
#
server.error-handler-404 = "/redirect.html"

## for better debugging
#server.modules += ( "mod_accesslog" )
#accesslog.filename = "/opt/piratebox/tmp/access.log"


# Fix for iOS7
# It ask especially different domains without a specific URL.
# It want to get a "success" message, to allow full system/internet access
$HTTP["useragent"] =~ "CaptiveNetworkSupport" {
server.document-root = "/opt/piratebox/www/library/test/"
index-file.names = ( "success.html" )
dir-listing.activate = "disable"
server.error-handler-404 = "/success.html"
}

echo 'server.bind = "192.168.77.1" '

/etc/apache2/ports.conf

# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default.conf

Listen 192.168.77.2:80
Listen 127.0.0.1:80

<IfModule ssl_module>
Listen 443
</IfModule>

<IfModule mod_gnutls.c>
Listen 443
</IfModule>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
Re: Running piratebox with apache instead of lighttpd
January 05, 2015 06:27AM
Hi,
well, that explains everything.
You were supposed to run those commands on the command line and not try to insert the lines to the file...

Please change the files as follows:

lighttpd.conf
from
echo 'server.bind = "192.168.77.1" '
to
server.bind = "192.168.77.1"

/opt/piratebox/conf/hosts
echo "www.$HOST $NET.2" >> /opt/piratebox/conf/hosts
to
echo "www.piratebox.lan 192.168.77.2" >> /opt/piratebox/conf/hosts

/opt/piratebox/bin/hooks/hook_piratebox_start_done.sh
echo '

if [ ! -f $1 ] ; then
echo "Config-File $1 not found..."
exit 255
fi

#Load config
. $1

ifconfig "$INTERFACE":0 $NET.2 up

/etc/init.d/apache restart

'
to
if [ ! -f $1 ] ; then
echo "Config-File $1 not found..."
exit 255
fi

#Load config
. $1

ifconfig "$INTERFACE":0 $NET.2 up

/etc/init.d/apache restart


that should make it after a restart.


This is only my signature.
Re: Running piratebox with apache instead of lighttpd
January 05, 2015 04:05PM
Ok i think I've applied all of these...

It looks that there are now two ip addresses from piratebox....

192.168.77.1 goes to page of lighttpd, so it goes main page of piratebox
192.168.77.2 goes nowhere...can't access this one. So I can't access web page of apache again
Re: Running piratebox with apache instead of lighttpd
January 05, 2015 06:32PM
check the error logs of apache