Use lighttpd+php (fastcgi) under Windows +mysql

Source: Internet
Author: User
Tags bz2

I. Windows compilation configuration Execution lighttpd

1, download and install Cygwin.

2, download lighttpd source code and unzip
3, in the Cygwin environment into the LIGHTTPD decompression folder, the execution:
1>./configure–prefix=c:/lighthttd
2> make

3> make Install

OK, at this time in the C:/LIGHTHTTD to get the compiled program, but can not directly execute, you need to copy some of the dependent libraries from the Cygwin installation folder:

Cyggcc_s-1.dll

Cygpcre-0.dll

Cygwin1.dll

Cyglightcomp.dll

If there are other self-prompted to join, can not find a direct search file.

4.lighttp Configuration


#lighttpd安装文件夹, remember that it must be an absolute path, or fastcgi execution will fail

Var.root = "c \lighttp"

#以下须要启用mod_fastcgi, remove the "#" from the front.
Server.modules = (
# "Mod_rewrite",
# "Mod_redirect",
# "Mod_alias",
"Mod_access",
# "MOD_CML",
# "MOD_TRIGGER_B4_DL",
# "Mod_auth",
# "Mod_status",
# "Mod_setenv",
"Mod_fastcgi",
# "Mod_proxy",
# "Mod_simple_vhost",
# "Mod_evhost",
# "Mod_userdir",
# "mod_cgi",
# "Mod_compress",
# "Mod_ssi",
# "Mod_usertrack",
# "Mod_expire",
# "Mod_secdownload",
# "Mod_rrdtool",
"Mod_accesslog")

Server.tag = "lighttpd/1.x"

#服务器port号
Server.port = 8080
Server.document-root = Var.root + "\website"
Server.errorlog = Var.root + "\logs\error.log"
Accesslog.filename = Var.root + "\logs\access.log"

#加默认主页
Index-file.names = ("index.php", "index.html",
"Index.htm", "default.htm")

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"
)

Mimetype.use-xattr = "Enable"

Url.access-deny = ("~", ". Inc")

$HTTP ["url"] =~ "\.pdf$" {
server.range-requests = "Disable"
}

Static-file.exclude-extensions = (". php")

#设置fast-cgi of the execution server, according to the following way to set, the following port number, the corresponding php-cgi the start port number, can be changed according to the need
Fastcgi.server = (". php" + = ("localhost" + = ("host" = "127.0.0.1", "Port" = 1919 )))


After the above configuration is complete, save to lighttpd.conf, put in the lighttpd root folder. (Name path you can change casually)

Command line execution:

Lighttpd.exe-d-M lib-f "c:\lighttpd\lighttpd.conf"

There are a lot of other needs to look directly at its command line help and I don't introduce


Two. PHP Installation configuration execution

If installed, please select "Other CGI", non-installed version of the words can be php-cgi.exe.


Changes in the configuration:

Cgi.fix_pathinfo = 1

Command line execution:

php-cgi. Exe-b 127.0.0.1: 1919 - C "PHP.ini"

1919 settings in the corresponding LIGHTTPD


Three. MySQL does not introduce, download the installation can be


OK, all done, new PHP file test it. It is important to note that the PHP-CGI program executes a certain number of PHP scripts to exit itself, so write a maintenance program or find a third-party monitoring management program.


Use lighttpd+php (fastcgi) under Windows +mysql

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.