Thiết lập lighttpd server để view documents TEXT, DOC, EXEL, PDF cho FW 2.X:
Trưứoc đây khi còn dùng FW 1.1.4 ai cũng biết cách làm cấu hình lighttpd server để view trên Safari.Nhưng lên FW 2.1 thì không biết làm ra sao.
Ưu điểm: Nhẹ - Miễn phí nhé.Bạn view tài liệu rất tiện. Có phím Back để quay về đầu.Cái này hiện tại chưa cái nào có cả ( TextGuru, Docs ), riêng ReaddleDocsthì chỉ có phím đó ở chế độ Portrait, xoay sang Landscape là mất lun (chán wá).Phím Back cự kỳ hữu dụng khi view các docs có Table Content (Chỉ mục ấy).
Sau một hồi tìm kiếm và làm thử thì đây là cách làm.
Em viết hơi chi tiết quá.Mong các cao thủ biết rồi thì đừng chửi nhé.:sorry8bj:
Công cụ:
Bosspref-Cái nầy ai cũng biết
Lighttpd (Khoảng 1,008 Mb)-Tìm trong Cydia
Trưứoc đây khi còn dùng FW 1.1.4 ai cũng biết cách làm cấu hình lighttpd server để view trên Safari.Nhưng lên FW 2.1 thì không biết làm ra sao.
Ưu điểm: Nhẹ - Miễn phí nhé.Bạn view tài liệu rất tiện. Có phím Back để quay về đầu.Cái này hiện tại chưa cái nào có cả ( TextGuru, Docs ), riêng ReaddleDocsthì chỉ có phím đó ở chế độ Portrait, xoay sang Landscape là mất lun (chán wá).Phím Back cự kỳ hữu dụng khi view các docs có Table Content (Chỉ mục ấy).
Sau một hồi tìm kiếm và làm thử thì đây là cách làm.
Em viết hơi chi tiết quá.Mong các cao thủ biết rồi thì đừng chửi nhé.:sorry8bj:
Công cụ:
Bosspref-Cái nầy ai cũng biết
Lighttpd (Khoảng 1,008 Mb)-Tìm trong Cydia
===
1.Tạo file cấu hình lighttpd có dạng sau (dùng Notepad):
HTML:
####################################################### ### 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 #######################################################
Chú ý : trong file trên, ngầm định thư mục để Document của chúng ta là : "/private/var/mobile/Sites/" (có nghĩa bạn phải tạo thư mục Sites trong cái /private/var/mobile/ vì có dòng:
server.document-root = "/private/var/mobile/Sites/"
Nếu bác nào không thích cái nầy thì có thể để ở chỗ khác.Máy của em thì em sửa lại là
"/private/var/mobile/Documents/" thì sửa lại cái dòng đó cho về cái nơi ta cất tài liệu
2.Trên Iphone, tạo thư mục etc bằng Winscp hay công cụ quen thuộc trong
3.Vậy là ta được thư mục mới : /usr/etc
4.Copy file lighttpd.conf vào thư mục đó, ta được /usr/etc/lighttpd.conf
5.Tạo file com.http.lighttpd.plist bằng Notepad có nội dung sau:
HTML:
<?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>
Quảng cáo
Sau đó copy vào /Library/LaunchDaemons/com.http.lighttpd.plist
6.Mở Safari và gõ :
http://127.0.0.1
Hic.
http://img213.imageshack.us/img213/9345/img0001wm8.jpg
Documents đã hiện ra.Lại xem được như FW 1.1.4
7.Bạn có thể Add Bookmark ra màn hình và thay cái icon bằng cái mà bạn thích bằng cách bạn copy icon.png thay thế cái icon.png trong /private/var/mobile/Library/WebClips tương ứng.
Chúc các bác thành công.Cái nầy em đã test trên máy em. FW 2.1 custom của bác sonpham1102.
Quảng cáo
Nếu bài viết có ích-Các bác nhấn Thank cái để khích lệ nhé.😁