The ModMyTM Family of Sites:
ModMyMotoModMyiModMyGphone




 
 
Register or Connect with Facebook

Discuss AppStore Apps | Browse / Search Cydia | MMi Cydia Stats




  Apple Forums & iPhone Forums, Mods, Hacks, News, Themes, Downloads, and more! | ModMyi.com > 3rd Party Apps For iPhone | iPod Touch > Native iPhone / iPod Touch App Discussion
Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 08-07-2008, 10:40 AM
xogen's Avatar
Green Apple
 
Join Date: Jul 2008
Device + Firmware: Touch - 2.1
Operating System: Slackware-OSx86-WindowsXP
Posts: 41
Thanks: 0
Thanked 7 Times in 6 Posts
Setting up lighttpd web server on 2.0

After I upgraded to 2.0 one of the things I missed the most was my web server. I used it to host my documentation, both in html form and pdf, and it kept it organized. When I saw that lighttpd was available for 2.0 I immediately installed it ...it didn't work oob, so here's what I did...

First I had to create a configuration file. I placed this here: /usr/etc/lighttpd.conf and it looks like this:

Code:
#######################################################
###  lighttpd.conf  BEGIN
#######################################################
#
#### modules to load
server.modules           = ( "mod_expire",
			     "mod_auth",
                             "mod_access",
                             "mod_evasive",
                             "mod_compress",
                             "mod_status",
                             "mod_redirect",
                             "mod_accesslog" )

#### performance options (aggressive timeouts)
server.max-keep-alive-requests = 6
server.max-keep-alive-idle = 15
server.max-read-idle     = 15
server.max-write-idle    = 15

## single client connection bandwidth limit in kilobytes (0=unlimited)
connection.kbytes-per-second = 0

## global server bandwidth limit in kilobytes (0=unlimited)
server.kbytes-per-second = 0

#### bind to interface (default: all interfaces)
server.bind              = "127.0.0.1"

#### bind to port (default: 80)
server.port              = 80

#### run daemon as uid (default: don't care)
server.username          = "nobody"

#### run daemon as gid (default: don't care)
server.groupname         = "nobody"

#### set the pid file (newsyslog)
server.pid-file          = "/var/run/lighttpd.pid"

#### name the server daemon publicly displays
server.tag               = "lighttpd"

#### static document-root
server.document-root     = "/private/var/mobile/Sites/"

#### chroot() to directory (default: no chroot() )
server.chroot            = "/"

#### files to check for if .../ is requested
index-file.names         = ( "index.html" )

#### disable auto index directory listings
dir-listing.activate     = "disable"

#### disable ssl if not needed
ssl.engine               = "disable"

#### compress module
compress.cache-dir       = "/private/var/tmp/"
compress.filetype        = ("text/plain", "text/html", "text/css", "image/png")

#### expire module
expire.url               = ( "" => "access plus 6 hours")

#### accesslog module
accesslog.filename       = "/var/log/lighttpd/access.log"

#### error log
server.errorlog          = "/var/log/lighttpd/error.log"

#### mod_evasive
evasive.max-conns-per-ip = 250

#### limit request method "POST" size in kilobytes (KB)
server.max-request-size  = 1

#### disable multi range requests
server.range-requests    = "disable"

#### disable symlinks
server.follow-symlink    = "disable"

#### ONLY serve files with all lowercase file names
server.force-lowercase-filenames = "disable"

#### mimetype mapping
mimetype.assign             = (
  ".pdf"          =>      "application/pdf",
  ".sig"          =>      "application/pgp-signature",
  ".spl"          =>      "application/futuresplash",
  ".class"        =>      "application/octet-stream",
  ".ps"           =>      "application/postscript",
  ".torrent"      =>      "application/x-bittorrent",
  ".dvi"          =>      "application/x-dvi",
  ".gz"           =>      "application/x-gzip",
  ".pac"          =>      "application/x-ns-proxy-autoconfig",
  ".swf"          =>      "application/x-shockwave-flash",
  ".tar.gz"       =>      "application/x-tgz",
  ".tgz"          =>      "application/x-tgz",
  ".tar"          =>      "application/x-tar",
  ".zip"          =>      "application/zip",
  ".mp3"          =>      "audio/mpeg",
  ".m3u"          =>      "audio/x-mpegurl",
  ".wma"          =>      "audio/x-ms-wma",
  ".wax"          =>      "audio/x-ms-wax",
  ".ogg"          =>      "application/ogg",
  ".wav"          =>      "audio/x-wav",
  ".gif"          =>      "image/gif",
  ".jpg"          =>      "image/jpeg",
  ".jpeg"         =>      "image/jpeg",
  ".png"          =>      "image/png",
  ".xbm"          =>      "image/x-xbitmap",
  ".xpm"          =>      "image/x-xpixmap",
  ".xwd"          =>      "image/x-xwindowdump",
  ".css"          =>      "text/css",
  ".html"         =>      "text/html",
  ".htm"          =>      "text/html",
  ".js"           =>      "text/javascript",
  ".asc"          =>      "text/plain",
  ".c"            =>      "text/plain",
  ".cpp"          =>      "text/plain",
  ".log"          =>      "text/plain",
  ".conf"         =>      "text/plain",
  ".text"         =>      "text/plain",
  ".txt"          =>      "text/plain",
  ".dtd"          =>      "text/xml",
  ".xml"          =>      "text/xml",
  ".mpeg"         =>      "video/mpeg",
  ".mpg"          =>      "video/mpeg",
  ".mov"          =>      "video/quicktime",
  ".qt"           =>      "video/quicktime",
  ".avi"          =>      "video/x-msvideo",
  ".asf"          =>      "video/x-ms-asf",
  ".asx"          =>      "video/x-ms-asf",
  ".wmv"          =>      "video/x-ms-wmv",
  ".bz2"          =>      "application/x-bzip",
  ".tbz"          =>      "application/x-bzip-compressed-tar",
  ".tar.bz2"      =>      "application/x-bzip-compressed-tar"
 )
#
#######################################################
###  lighttpd.conf  END
#######################################################
This is a simple configuration and you will want to review it. Change this line:

Code:
server.document-root     = "/private/var/mobile/Sites/"
to reflect the location of your documents. You will also need to create the folder:

Code:
# mkdir /var/log/lighttpd
and change the folders ownership to user nobody:

Code:
# chown nobody:nobody /var/log/lighttpd
so that lighttpd can log events. Next I wanted it to run at startup so I created a plist:

HTML Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.http.lighttpd</string>
    <key>ProgramArguments</key>
    <array>
      <string>/usr/sbin/lighttpd</string>
      <string>-f</string>
      <string>/usr/etc/lighttpd.conf</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
</dict>
</plist>
and saved it as /Library/LaunchDaemons/com.http.lighttpd.plist

Then I loaded it with the command:

Code:
# launchctl load -w /Library/LaunchDaemons/com.http.lighttpd.plist
and viewed my test html file with Safari. Success!!

EDIT: server.groupname = "nobody"
should be: server.groupname = "nogroup"

but will work either way.

Last edited by xogen; 08-11-2008 at 02:55 PM.. Reason: Typo
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
The Following User Says Thank You to xogen For This Useful Post:
kavehmb (10-13-2008)
  #2  
Old 08-07-2008, 10:42 PM
What's Jailbreak?
 
Join Date: Jul 2008
Device + Firmware: iphone 3g - 2.0 pwnd
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts

Well I think I got it setup right just don't know how to veiw my test html file that I have put into /private/var/mobile/Sites

any help would be great thanks again
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #3  
Old 08-07-2008, 11:10 PM
Jah's Avatar
Jah Jah is offline
Green Apple
 
Join Date: Sep 2007
Device + Firmware: 8GB Gen1 iPhone / FW: 2.0
Operating System: WinXP SP3 / Mac OSX 10.4/10.5
Posts: 31
Thanks: 3
Thanked 10 Times in 6 Posts

Quote:
Originally Posted by chunkd View Post
Well I think I got it setup right just don't know how to veiw my test html file that I have put into /private/var/mobile/Sites

any help would be great thanks again
well if that is your doc root as specified in the config file, than to view it you would open safari and type one of the following:
Code:
http://127.0.0.1
Code:
http://localhost/
if you see your page, success!
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #4  
Old 08-08-2008, 07:09 PM
What's Jailbreak?
 
Join Date: Aug 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

Hey, I just bought a 3g Iphone and jailbroke it. How can I install lighttpd straight away? is there a package somewhere I can download? (i dont have installer, only cydia)
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #5  
Old 08-10-2008, 02:25 AM
What's Jailbreak?
 
Join Date: Dec 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts

Hi exogen,

I wanted to run lighttpd too on my iPhone 2.0.1 2G.
I setup everything as explained by you above.

Now I have three problems/questions you might be able to help me with:

1. When I connect to the server I always get a "403 - Forbidden" response from it.

2. What's the suggested way to stop the daemon again?

3. Have you added lighttpd as a custom service to BossPrefs and did it work? If yes, how?

Thanks.
pac^man
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #6  
Old 08-10-2008, 10:15 PM
What's Jailbreak?
 
Join Date: Aug 2008
Device + Firmware: iPod Touch 2.2.1 ;)
Operating System: Windows XP / Mandriva Spring 2008 (Linux)
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
fixing the 403:

Well I modified the lighttpd.conf file.

- I removed the bind (so the server is now public and available to all computers on my lan)

- I removed the nobody user/group ... so everyone will have access

- I enabled the folder listing for files.

(In my setup, I have an index.html file wich looks cute as a front end.. an enter link that goes to /shared and I put all my files in there )

here is my lighttpd.conf file ..
for the rest THANKS A LOT FOR THE NICE TUT M8! !!!
(his setup is WAY more secure than mine... once again.. I DO want to share!)

Code:
#######################################################
###  lighttpd.conf  BEGIN
#######################################################
#
#### modules to load
server.modules           = ( "mod_expire",
			     "mod_auth",
                             "mod_access",
                             "mod_evasive",
                             "mod_compress",
                             "mod_status",
                             "mod_redirect",
                             "mod_accesslog" )

#### performance options (aggressive timeouts)
server.max-keep-alive-requests = 6
server.max-keep-alive-idle = 15
server.max-read-idle     = 15
server.max-write-idle    = 15

## single client connection bandwidth limit in kilobytes (0=unlimited)
connection.kbytes-per-second = 0

## global server bandwidth limit in kilobytes (0=unlimited)
server.kbytes-per-second = 0

#### bind to interface (default: all interfaces)
#server.bind              = "127.0.0.1"

#### bind to port (default: 80)
server.port              = 80

#### run daemon as uid (default: don't care)
#server.username          = "nobody"

#### run daemon as gid (default: don't care)
#server.groupname         = "nobody"

#### set the pid file (newsyslog)
server.pid-file          = "/var/run/lighttpd.pid"

#### name the server daemon publicly displays
server.tag               = "lighttpd"

#### static document-root
server.document-root     = "/private/var/mobile/Sites/"

#### chroot() to directory (default: no chroot() )
server.chroot            = "/"

#### files to check for if .../ is requested
index-file.names         = ( "index.html" )

#### disable auto index directory listings
dir-listing.activate     = "enable"

#### disable ssl if not needed
ssl.engine               = "disable"

#### compress module
compress.cache-dir       = "/private/var/tmp/"
compress.filetype        = ("text/plain", "text/html", "text/css", "image/png")

#### expire module
expire.url               = ( "" => "access plus 6 hours")

#### accesslog module
accesslog.filename       = "/var/log/lighttpd/access.log"

#### error log
server.errorlog          = "/var/log/lighttpd/error.log"

#### mod_evasive
evasive.max-conns-per-ip = 250

#### limit request method "POST" size in kilobytes (KB)
server.max-request-size  = 1

#### disable multi range requests
server.range-requests    = "disable"

#### disable symlinks
server.follow-symlink    = "disable"

#### ONLY serve files with all lowercase file names
server.force-lowercase-filenames = "disable"

#### mimetype mapping
mimetype.assign             = (
  ".pdf"          =>      "application/pdf",
  ".sig"          =>      "application/pgp-signature",
  ".spl"          =>      "application/futuresplash",
  ".class"        =>      "application/octet-stream",
  ".ps"           =>      "application/postscript",
  ".torrent"      =>      "application/x-bittorrent",
  ".dvi"          =>      "application/x-dvi",
  ".gz"           =>      "application/x-gzip",
  ".pac"          =>      "application/x-ns-proxy-autoconfig",
  ".swf"          =>      "application/x-shockwave-flash",
  ".tar.gz"       =>      "application/x-tgz",
  ".tgz"          =>      "application/x-tgz",
  ".tar"          =>      "application/x-tar",
  ".zip"          =>      "application/zip",
  ".mp3"          =>      "audio/mpeg",
  ".m3u"          =>      "audio/x-mpegurl",
  ".wma"          =>      "audio/x-ms-wma",
  ".wax"          =>      "audio/x-ms-wax",
  ".ogg"          =>      "application/ogg",
  ".wav"          =>      "audio/x-wav",
  ".gif"          =>      "image/gif",
  ".jpg"          =>      "image/jpeg",
  ".jpeg"         =>      "image/jpeg",
  ".png"          =>      "image/png",
  ".xbm"          =>      "image/x-xbitmap",
  ".xpm"          =>      "image/x-xpixmap",
  ".xwd"          =>      "image/x-xwindowdump",
  ".css"          =>      "text/css",
  ".html"         =>      "text/html",
  ".htm"          =>      "text/html",
  ".js"           =>      "text/javascript",
  ".asc"          =>      "text/plain",
  ".c"            =>      "text/plain",
  ".cpp"          =>      "text/plain",
  ".log"          =>      "text/plain",
  ".conf"         =>      "text/plain",
  ".text"         =>      "text/plain",
  ".txt"          =>      "text/plain",
  ".dtd"          =>      "text/xml",
  ".xml"          =>      "text/xml",
  ".mpeg"         =>      "video/mpeg",
  ".mpg"          =>      "video/mpeg",
  ".mov"          =>      "video/quicktime",
  ".qt"           =>      "video/quicktime",
  ".avi"          =>      "video/x-msvideo",
  ".asf"          =>      "video/x-ms-asf",
  ".asx"          =>      "video/x-ms-asf",
  ".wmv"          =>      "video/x-ms-wmv",
  ".bz2"          =>      "application/x-bzip",
  ".tbz"          =>      "application/x-bzip-compressed-tar",
  ".tar.bz2"      =>      "application/x-bzip-compressed-tar"
 )
#
#######################################################
###  lighttpd.conf  END
#######################################################
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #7  
Old 08-11-2008, 06:51 AM
What's Jailbreak?
 
Join Date: Jun 2008
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts

can u share the "index.html" file?

actaully, lighttpd works well on my iphone 2.0, but how can i get the outlook like this?
Click the image to open in full size.

Last edited by ajnakata; 08-11-2008 at 06:51 AM.. Reason: Automerged Doublepost
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #8  
Old 08-11-2008, 03:09 PM
xogen's Avatar
Green Apple
 
Join Date: Jul 2008
Device + Firmware: Touch - 2.1
Operating System: Slackware-OSx86-WindowsXP
Posts: 41
Thanks: 0
Thanked 7 Times in 6 Posts

@madlogic "- I removed the nobody user/group ... so everyone will have access"

this is the user:group that the webserver switches to after starting.

if you are having access errors (403 - Forbidden) it's because the document root folder (/private/var/mobile/Sites) is not accessible by the webservers user (nobody). to fix this, chmod 755 /private/var/mobile so the user nobody can access the mobile user folder.

@ajnakata - if you want directory listing, change this line in your configuration and restart the web server: dir-listing.activate = "disable" to "enable"

@pac^man - you could use the command: launchctl unload /Library/LaunchDaemons/com.http.lighttpd.plist . I haven't tested it with bossprefs but the commands to load and unload should be the same in bossprefs. the 'ps' listing for lighttpd is lighttpd.

Last edited by xogen; 08-11-2008 at 03:16 PM.. Reason: Automerged Doublepost
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #9  
Old 08-11-2008, 06:54 PM
What's Jailbreak?
 
Join Date: Aug 2008
Device + Firmware: iPod Touch 2.2.1 ;)
Operating System: Windows XP / Mandriva Spring 2008 (Linux)
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts

@: ajnakata
might not be as cute.. but can be modified

RapidShare: Easy Filehosting

ps: I put my files in a /shared subfolder
based on the work of :Brad Micallef
http://groups.google.com/group/iphon...8175fff9af8c5e

full template with all forms elements:
http://iphonewebdev.googlegroups.com/web/iPhone_template_ver1-1.zip?gda=p7_meEwAAAA4WuQBM7mTs1B5SjMMBCY2MR66MTMU 2sUveiUAkBXI8xTtkw2uIXHBpeenu2NQPK8HdBvCykUIZvI5Vc r9HQcP_Vpvmo5s1aABVJRO3P3wLQ

Last edited by madlogik; 08-11-2008 at 06:57 PM..
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #10  
Old 08-12-2008, 04:17 AM
What's Jailbreak?
 
Join Date: Oct 2007
Posts: 20
Thanks: 4
Thanked 1 Time in 1 Post

To chmod /private/var/mobile to 755

In terminal type:

Code:
chmod 755 /private/var/mobile
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #11  
Old 08-13-2008, 07:36 AM
What's Jailbreak?
 
Join Date: Dec 2007
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts

Whenever I do the "launchctl load ...", I get the error: "launch_msg(): Socket is not connected" Anybody have an idea what to do from here?
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #12  
Old 08-13-2008, 10:23 AM
xogen's Avatar
Green Apple
 
Join Date: Jul 2008
Device + Firmware: Touch - 2.1
Operating System: Slackware-OSx86-WindowsXP
Posts: 41
Thanks: 0
Thanked 7 Times in 6 Posts

Quote:
Originally Posted by danc4498 View Post
Whenever I do the "launchctl load ...", I get the error: "launch_msg(): Socket is not connected" Anybody have an idea what to do from here?
You are running this command as user mobile. It needs to be run as user root.
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #13  
Old 08-13-2008, 10:46 AM
What's Jailbreak?
 
Join Date: Dec 2007
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts

Quote:
Originally Posted by xogen View Post
You are running this command as user mobile. It needs to be run as user root.
Well, I just tried this on the terminal, I logged in as root, and then ran the same command and got the same error.
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #14  
Old 08-13-2008, 01:52 PM
xogen's Avatar
Green Apple
 
Join Date: Jul 2008
Device + Firmware: Touch - 2.1
Operating System: Slackware-OSx86-WindowsXP
Posts: 41
Thanks: 0
Thanked 7 Times in 6 Posts

What firmware version are you using?
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #15  
Old 08-13-2008, 01:55 PM
What's Jailbreak?
 
Join Date: Dec 2007
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts

Quote:
Originally Posted by xogen View Post
What firmware version are you using?
I'm using the jailbroken 2.0.1
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
Reply

  Apple Forums & iPhone Forums, Mods, Hacks, News, Themes, Downloads, and more! | ModMyi.com > 3rd Party Apps For iPhone | iPod Touch > Native iPhone / iPod Touch App Discussion

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



Go to Top
ModMyI

All times are GMT -6. The time now is 12:59 AM. Powered by vBulletin® Version 3.8.4
If you need Dedicated Server Hosting, you should check out SingleHop. | Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.0 Copyright © 2007-09 by ModMy, LLC. All rights reserved.

iPhone News / iPhone Forums / Apple News / Apple Forums / RSS / Contact Us / / Privacy Statement / Top