Micro Web Servers
Copyright 2011 Technoids.com



Extra Stuff
Manual Uninstalls SSH Console


Perl
apt-get -y remove perl
PHP
apt-get -y remove php
Nano
apt-get -y remove nano
Top
apt-get -y remove top


Web
apt-get -y remove lighttpd
Server
rm  /Library/LaunchDaemons/com.http.lighttpd.plist

rm /System/Library/LaunchDaemons/com.http.lighttpd.plist

rm /private/etc/mod_fastcgi.conf

rm /private/etc/lighttpd.conf

rm /usr/lib/php.ini

rm /var/log/lighttpd/access.log

rm /var/log/lighttpd/errors.log
favicon.ico      What is a favicon ?

Place this code between in your index.html or index.php
between <head> and </head>

<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
<link rel="icon" href="/favicon.ico" type="image/x-icon">

Put the favicon.ico in the web root /var/private/www/
uninstaller.zip


Uninstaller

Uninstall Lighttpd PHP & Perl
Remove Configs Plists etc
Reload All the Default Processes
Works with TV iPod Touch iPad iPhone

Unzip uninstaller.zip
SFTP to /private/var/tmp
SSH console (Putty)
cd /tmp
bash uninstaller.sh



Note: About a Reboot

Clears all files from the /private/var/tmp/ (/tmp/) folder
including compressed html web files automatically


Useful Commands



ps -ax
top
find / -name filename
uptime
help
ls -altr
shopt
reboot
apt-get update
history
iostat
uname -a
dpkg -l
df -h
apt-get upgrade
hostinfo
netstat -s
ifconfig -a
Apple TV 2G general.log
/var/mobile/Library/Logs/AppleSupport/general.log
If this log is deleted it recreates itself
Simplist way to disable Lighttpd
SSH console
rm  /Library/LaunchDaemons/com.http.lighttpd.plist
rm /System/Library/LaunchDaemons/com.http.lighttpd.plist
reboot

Update Apps
SSH console
apt-get update
apt-get upgrade



ImageMagick
apt-get -y install imagemagick
Rsync
apt-get -y install rsync
Optional Manual Installs SSH Console


WordPress 3.X Installation Instructions are here

Add this line to the /private/etc/lighttpd.conf
url.access-deny = ( "~", ".sqlite" )
For Wordpress security reasons
How to install a working GCC
SysHalt
89GeekBlog

GCC installer is here (by Technoids.com)
Unzip gccinstaller.zip
SFTP gccinstaller.sh /private/var/tmp/
SSH  cd /tmp
         bash gccinstaller.sh

Simple Daily 3:15AM Log Rotator With Compression

com.rotate.logs.plist (/Library/LaunchDaemons/)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>Label</key>
  <string>com.rotate.logs</string>
  <key>ProgramArguments</key>
  <array>
    <string>/Library/Scripts/logs.sh</string>
  </array>
  <key>LowPriorityIO</key>
  <true/>
  <key>Nice</key>
  <integer>1</integer>
  <key>StartCalendarInterval</key>
  <dict>
    <key>Hour</key>
    <integer>3</integer>
    <key>Minute</key>
    <integer>15</integer>
  </dict>
</dict>
</plist>

logs.sh (/Library/Scripts/)

cd /private/var/log/lighttpd/
killall lighttpd
killall lighttpd
mv /private/var/log/lighttpd/access.log  /private/var/log/lighttpd/"`date +%Y%m%d`_access.log"
killall lighttpd
mv /private/var/log/lighttpd/error.log  /private/var/log/lighttpd/"`date +%Y%m%d`_error.log"
killall lighttpd
gzip -f /private/var/log/lighttpd/"`date +%Y%m%d`_access.log"
gzip -f /private/var/log/lighttpd/"`date +%Y%m%d`_error.log"
A Complete Proper Uninstall
apt-get remove --purge package
apt-get clean
find . -type f -size +50000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'
Find files greater then 50 mbytes ( Install Gawk => apt-get install gawk )

find . -type f -printf '%TY-%Tm-%Td %TT %p\n' | sort | tail -n 25
List the last 25 files changed

find . -exec grep -H 'content' {} \;
Find files containing content
Capture and Decode SSL Traffic
Mitmproxy an SSL-capable man-in-the-middle proxy (Needs Python)
apt-get install python