Logged in as Anonymous. Lần truy cập trước của bạn:

You are not connected. Please login or register

Xem chủ đề cũ hơn Xem chủ đề mới hơn Go down Thông điệp [Trang 1 trong tổng số 1 trang]

avatar
  • MASTER

Cây Đèn Thần





Hướng dẫn setup website trên iphone có thể chạy php,.....

Bước 1. Lên cydia cài đặt gói lighttpd

Hoặc có thể ssh dùng lệnh để cài.
# apt-get install lighttpd

iPhone-4s:~ root# apt-get install lighttpd
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libxml2 libxml2-lib sqlite3 sqlite3-lib
The following NEW packages will be installed:
libxml2 libxml2-lib lighttpd sqlite3 sqlite3-lib
0 upgraded, 5 newly installed, 0 to remove and 2 not upgraded.
Need to get 439kB of archives.
After this operation, 2105kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://apt.saurik.com ios/675.00/main libxml2-lib 2.6.32-3 [1218B]
Get:2 http://apt.saurik.com ios/675.00/main libxml2 2.6.32-6 [90.6kB]
Get:3 http://apt.saurik.com ios/675.00/main sqlite3-lib 3.5.9-2 [686B]
Get:4 http://apt.saurik.com ios/675.00/main sqlite3 3.5.9-12 [71.9kB]
Get:5 http://apt.saurik.com ios/675.00/main lighttpd 1.4.18-6 [274kB]
Fetched 439kB in 7s (55.5kB/s)
Selecting previously deselected package libxml2-lib.
(Reading database ... 9162 files and directories currently installed.)
Unpacking libxml2-lib (from .../libxml2-lib_2.6.32-3_iphoneos-arm.deb) ...
Selecting previously deselected package libxml2.
Unpacking libxml2 (from .../libxml2_2.6.32-6_iphoneos-arm.deb) ...
Selecting previously deselected package sqlite3-lib.
Unpacking sqlite3-lib (from .../sqlite3-lib_3.5.9-2_iphoneos-arm.deb) ...
Selecting previously deselected package sqlite3.
Unpacking sqlite3 (from .../sqlite3_3.5.9-12_iphoneos-arm.deb) ...
Selecting previously deselected package lighttpd.
Unpacking lighttpd (from .../lighttpd_1.4.18-6_iphoneos-arm.deb) ...
Setting up libxml2-lib (2.6.32-3) ...
Setting up libxml2 (2.6.32-6) ...
Setting up sqlite3-lib (3.5.9-2) ...
Setting up sqlite3 (3.5.9-12) ...
Setting up lighttpd (1.4.18-6) ...



Bước 2: Tạo các thư mục

/private/var/mobile/site/
/var/log/lighttpd


Mã:
mkdir /private/var/mobile/site/
mkdir /var/log/lighttpd
Chang owner và group của thư mục /var/log/lighttpd

Mã:
chown nobody:nobody /var/log/lighttpd

Bước 3: Tạo file /usr/etc/lighttpd.conf có nội dung như sau
Mã:
#######################################################
### 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 = "nogroup"

#### 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/site/"

"/usr/etc/lighttpd.conf" 146 lines, 5007 characters
#######################################################
### 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 = "nogroup"

#### 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/site/"

#### 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
#######################################################

Có thể thay thế thư mục document-root theo ý thích của mình

server.document-root = "/private/var/mobile/site/"


Bước 4: Tạo file /Library/LaunchDaemons/com.http.lighttpd.plist

Mã:

http://www.apple.com/DTDs/PropertyList-1.0.dtd">


Label
com.http.lighttpd
ProgramArguments

/usr/sbin/lighttpd
-f
/usr/etc/lighttpd.conf

RunAtLoad



Bước 4: chạy service lighttpd

launchctl load -w /Library/LaunchDaemons/com.http.lighttpd.plist



Note:
Dừng service lighttpd
# launchctl unload -w /Library/LaunchDaemons/com.http.lighttpd.plist

Check các service đang chạy
# launchctl list |grep service
60358 - 0xe555940.anonymous.lighttpd
59566 - 0xe5550d0.anonymous.lighttpd

Có thể dùng lệnh kill -9 để stop các service


Sau khi cài thành công có thể truy cập tại địa chỉ http://127.0.0.1 hoặc http://localhost


https://www.youtube.com/channel/UCajeicQMgd5Sd4ZG6E0oQ0g

https://www.youtube.com/channel/UCeu6NA_zTfdrnVNvRRVVL6A
Diễn Đàn

Xem chủ đề cũ hơn Xem chủ đề mới hơn Về Đầu Trang Thông điệp [Trang 1 trong tổng số 1 trang]


Permissions in this forum:
Bạn không có quyền trả lời bài viết