LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 2949|回复: 16

[已解决]lighttpd 的配置和wordpress

[复制链接]
发表于 2008-1-2 16:19:33 | 显示全部楼层 |阅读模式
启动apache有问题 ,错误信息:
http://rafb.net/p/5pvyGB27.html

使用
  1. # /etc/init.d/apache2 start --verbose --debug > apache.err 2>&1
复制代码
输出的。

现在使用lighttpd,能正常启动服务,但127.0.0.1显示403 - Forbidden。
我的配置文件:
  1. # cat /etc/lighttpd/lighttpd.conf
  2. ###############################################################################
  3. # Default lighttpd.conf for Gentoo.
  4. # $Header: /var/cvsroot/gentoo-x86/www-servers/lighttpd/files/conf/lighttpd.conf,v 1.3 2005/09/01 14:22:35 ka0ttic Exp $
  5. ###############################################################################

  6. # {{{ variables
  7. var.basedir  = "/var/www/localhost"
  8. var.logdir   = "/var/log/lighttpd"
  9. var.statedir = "/var/lib/lighttpd"
  10. # }}}

  11. # {{{ modules
  12. # At the very least, mod_access and mod_accesslog should be enabled.
  13. # All other modules should only be loaded if necessary.
  14. # NOTE: the order of modules is important.
  15. server.modules = (
  16. #    "mod_rewrite",
  17. #    "mod_redirect",
  18. #    "mod_alias",
  19.     "mod_access",
  20. #    "mod_cml",
  21. #    "mod_trigger_b4_dl",
  22. #    "mod_auth",
  23. #    "mod_status",
  24. #    "mod_setenv",
  25. #    "mod_proxy",
  26. #    "mod_simple_vhost",
  27. #    "mod_evhost",
  28. #    "mod_userdir",
  29. #    "mod_compress",
  30. #    "mod_ssi",
  31. #    "mod_usertrack",
  32. #    "mod_expire",
  33. #    "mod_secdownload",
  34. #    "mod_rrdtool",
  35. #    "mod_webdav",
  36.     "mod_accesslog"
  37. )
  38. # }}}

  39. # {{{ includes
  40. include "mime-types.conf"
  41. # uncomment for cgi support
  42. #   include "mod_cgi.conf"
  43. # uncomment for php/fastcgi support
  44. # 不需要cgi?
  45. include "mod_fastcgi.conf"
  46. # }}}

  47. # {{{ server settings
  48. server.username      = "lighttpd"
  49. server.groupname     = "lighttpd"

  50. server.document-root = var.basedir + "/htdocs"
  51. server.pid-file      = "/var/run/lighttpd.pid"

  52. server.errorlog      = var.logdir  + "/error.log"
  53. # log errors to syslog instead
  54. #   server.errorlog-use-syslog = "enable"

  55. server.indexfiles    = ("index.php", "index.html",
  56.                                                 "index.htm", "default.htm")

  57. # server.tag           = "lighttpd"

  58. server.follow-symlink = "enable"

  59. # event handler (defaults to "poll")
  60. # see performance.txt
  61. #
  62. # for >= linux-2.4
  63. #   server.event-handler = "linux-rtsig"
  64. # for >= linux-2.6
  65. #   server.event-handler = "linux-sysepoll"
  66. # for FreeBSD
  67. #   server.event-handler = "freebsd-kqueue"

  68. # chroot to directory (defaults to no chroot)
  69. # server.chroot      = "/"

  70. # bind to port (defaults to 80)
  71. # server.port          = 81

  72. # bind to name (defaults to all interfaces)
  73. # server.bind          = "grisu.home.kneschke.de"

  74. # error-handler for status 404
  75. # server.error-handler-404 = "/error-handler.html"
  76. # server.error-handler-404 = "/error-handler.php"

  77. # Format: <errorfile-prefix><status-code>.html
  78. # -> ..../status-404.html for 'File not found'
  79. # server.errorfile-prefix    = var.basedir + "/error/status-"

  80. # FAM support for caching stat() calls
  81. # requires that lighttpd be built with USE=fam
  82.    server.stat-cache-engine = "fam"
  83. # }}}

  84. # {{{ mod_staticfile

  85. # which extensions should not be handled via static-file transfer
  86. # (extensions that are usually handled by mod_cgi, mod_fastcgi, etc).
  87. static-file.exclude-extensions = (".php", ".pl", ".cgi", ".fcgi")
  88. # }}}

  89. # {{{ mod_accesslog
  90. accesslog.filename   = var.logdir + "/access.log"
  91. # }}}

  92. # {{{ mod_dirlisting
  93. # enable directory listings
  94. #   dir-listing.activate      = "enable"
  95. #
  96. # don't list hidden files/directories
  97. #   dir-listing.hide-dotfiles = "enable"
  98. #
  99. # use a different css for directory listings
  100. #   dir-listing.external-css  = "/path/to/dir-listing.css"
  101. #
  102. # list of regular expressions.  files that match any of the
  103. # specified regular expressions will be excluded from directory
  104. # listings.
  105. #   dir-listing.exclude = ("^\.", "~$")
  106. # }}}

  107. # {{{ mod_access
  108. # see access.txt

  109. url.access-deny = ("~", ".inc")
  110. # }}}

  111. # {{{ mod_userdir
  112. # see userdir.txt
  113. #
  114. # userdir.path = "public_html"
  115. # userdir.exclude-user = ("root")
  116. # }}}

  117. # {{{ mod_ssi
  118. # see ssi.txt
  119. #
  120. # ssi.extension = (".shtml")
  121. # }}}

  122. # {{{ mod_ssl
  123. # see ssl.txt
  124. #
  125. # ssl.engine    = "enable"
  126. # ssl.pemfile   = "server.pem"
  127. # }}}

  128. # {{{ mod_status
  129. # see status.txt
  130. #
  131. # status.status-url  = "/server-status"
  132. # status.config-url  = "/server-config"
  133. # }}}

  134. # {{{ mod_simple_vhost
  135. # see simple-vhost.txt
  136. #
  137. #  If you want name-based virtual hosting add the next three settings and load
  138. #  mod_simple_vhost
  139. #
  140. # document-root =
  141. #   virtual-server-root + virtual-server-default-host + virtual-server-docroot
  142. # or
  143. #   virtual-server-root + http-host + virtual-server-docroot
  144. #
  145. # simple-vhost.server-root   = "/home/weigon/wwwroot/servers/"
  146. # simple-vhost.default-host  = "grisu.home.kneschke.de"
  147. # simple-vhost.document-root = "/pages/"
  148. # }}}

  149. # {{{ mod_compress
  150. # see compress.txt
  151. #
  152. # compress.cache-dir   = var.statedir + "/cache/compress"
  153. # compress.filetype    = ("text/plain", "text/html")
  154. # }}}

  155. # {{{ mod_proxy
  156. # see proxy.txt
  157. #
  158. # proxy.server               = ( ".php" =>
  159. #                               ( "localhost" =>
  160. #                                 (
  161. #                                   "host" => "192.168.0.101",
  162. #                                   "port" => 80
  163. #                                 )
  164. #                               )
  165. #                             )
  166. # }}}

  167. # {{{ mod_auth
  168. # see authentication.txt
  169. #
  170. # auth.backend               = "plain"
  171. # auth.backend.plain.userfile = "lighttpd.user"
  172. # auth.backend.plain.groupfile = "lighttpd.group"

  173. # auth.backend.ldap.hostname = "localhost"
  174. # auth.backend.ldap.base-dn  = "dc=my-domain,dc=com"
  175. # auth.backend.ldap.filter   = "(uid=$)"

  176. # auth.require               = ( "/server-status" =>
  177. #                               (
  178. #                                 "method"  => "digest",
  179. #                                 "realm"   => "download archiv",
  180. #                                 "require" => "user=jan"
  181. #                               ),
  182. #                               "/server-info" =>
  183. #                               (
  184. #                                 "method"  => "digest",
  185. #                                 "realm"   => "download archiv",
  186. #                                 "require" => "valid-user"
  187. #                               )
  188. #                             )
  189. # }}}

  190. # {{{ mod_rewrite
  191. # see rewrite.txt
  192. #
  193. # url.rewrite = (
  194. #       "^/$"           =>              "/server-status"
  195. # )
  196. # }}}

  197. # {{{ mod_redirect
  198. # see redirect.txt
  199. #
  200. # url.redirect = (
  201. #       "^/wishlist/(.+)"               =>              "http://www.123.org/$1"
  202. # )
  203. # }}}

  204. # {{{ mod_evhost
  205. # define a pattern for the host url finding
  206. # %% => % sign
  207. # %0 => domain name + tld
  208. # %1 => tld
  209. # %2 => domain name without tld
  210. # %3 => subdomain 1 name
  211. # %4 => subdomain 2 name
  212. #
  213. # evhost.path-pattern        = "/home/storage/dev/www/%3/htdocs/"
  214. # }}}

  215. # {{{ mod_expire
  216. # expire.url = (
  217. #       "/buggy/"               =>              "access 2 hours",
  218. #       "/asdhas/"              =>              "access plus 1 seconds 2 minutes"
  219. # )
  220. # }}}

  221. # {{{ mod_rrdtool
  222. # see rrdtool.txt
  223. #
  224. # rrdtool.binary  = "/usr/bin/rrdtool"
  225. # rrdtool.db-name = var.statedir + "/lighttpd.rrd"
  226. # }}}

  227. # {{{ mod_setenv
  228. # see setenv.txt
  229. #
  230. # setenv.add-request-header  = ( "TRAV_ENV" => "mysql://user@host/db" )
  231. # setenv.add-response-header = ( "X-Secret-Message" => "42" )
  232. # }}}

  233. # {{{ mod_trigger_b4_dl
  234. # see trigger_b4_dl.txt
  235. #
  236. # trigger-before-download.gdbm-filename = "/home/weigon/testbase/trigger.db"
  237. # trigger-before-download.memcache-hosts = ( "127.0.0.1:11211" )
  238. # trigger-before-download.trigger-url = "^/trigger/"
  239. # trigger-before-download.download-url = "^/download/"
  240. # trigger-before-download.deny-url = "http://127.0.0.1/index.html"
  241. # trigger-before-download.trigger-timeout = 10
  242. # }}}

  243. # {{{ mod_cml
  244. # see cml.txt
  245. #
  246. # don't forget to add index.cml to server.indexfiles
  247. # cml.extension               = ".cml"
  248. # cml.memcache-hosts          = ( "127.0.0.1:11211" )
  249. # }}}

  250. # {{{ mod_webdav
  251. # see webdav.txt
  252. #
  253. # $HTTP["url"] =~ "^/dav($|/)" {
  254. #     webdav.activate = "enable"
  255. #     webdav.is-readonly = "enable"
  256. # }
  257. # }}}

  258. # {{{ extra rules
  259. #
  260. # set Content-Encoding and reset Content-Type for browsers that
  261. # support decompressing on-thy-fly (requires mod_setenv)
  262. # $HTTP["url"] =~ "\.gz$" {
  263. #     setenv.add-response-header = ("Content-Encoding" => "x-gzip")
  264. #     mimetype.assign = (".gz" => "text/plain")
  265. # }

  266. # $HTTP["url"] =~ "\.bz2$" {
  267. #     setenv.add-response-header = ("Content-Encoding" => "x-bzip2")
  268. #     mimetype.assign = (".bz2" => "text/plain")
  269. # }
  270. #
  271. # }}}

  272. # {{{ debug
  273. # debug.log-request-header   = "enable"
  274. # debug.log-response-header  = "enable"
  275. # debug.log-request-handling = "enable"
  276. # debug.log-file-not-found   = "enable"
  277. # }}}

  278. # vim: set ft=conf foldmethod=marker et :
复制代码


主要应用为本地的wordpress。

谢谢!
发表于 2008-1-2 19:54:23 | 显示全部楼层
http://trac.lighttpd.net/trac/wiki/Docs

dir-listing.activate      = "enable"
dir-listing.hide-dotfiles = "enable"
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-1-2 20:37:19 | 显示全部楼层
Post by keelort;1802425
http://trac.lighttpd.net/trac/wiki/Docs

dir-listing.activate      = "enable"
dir-listing.hide-dotfiles = "enable"


感谢,再多问一句,如何支持PHP?
回复 支持 反对

使用道具 举报

发表于 2008-1-2 21:37:32 | 显示全部楼层
[PHP]
server.modules += ("mod_fastcgi")
fastcgi.server = (
".php" => (
         (
          "host" => "127.0.0.1",
          "port" => 1026,
         "bin-path" => "/usr/bin/php-cgi"
  )
)
[/PHP]

在你的服务器配置里加上这个试试看
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-1-3 08:53:06 | 显示全部楼层
Post by yyccrasher;1802470
[PHP]
server.modules += ("mod_fastcgi")
fastcgi.server = (
".php" => (
         (
          "host" => "127.0.0.1",
          "port" => 1026,
         "bin-path" => "/usr/bin/php-cgi"
  )
)
[/PHP]

在你的服务器配置里加上这个试试看


出现错误:
  1. # /etc/init.d/lighttpd start
  2. Duplicate config variable in conditional 0 global: fastcgi.server
  3. 2008-01-03 08:50:03: (configfile.c.855) source: /etc/lighttpd/lighttpd.conf line: 333 pos: 1 parser failed somehow near here: (EOL)
复制代码
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-1-3 09:01:22 | 显示全部楼层
参考:http://gentoo-wiki.com/HOWTO_Lighttpd
将下列代码加入/etc/lighttpd/mod_fastcgi.conf
  1. server.modules += ("mod_fastcgi")
  2. fastcgi.server = ( ".php" =>
  3.    ( "localhost" =>
  4.      (
  5.        "host"     => "127.0.0.1",
  6.        "port"     => 1026,
  7.        "bin-path" => "/usr/bin/php-cgi"
  8.      )
  9.    )
  10. )
复制代码


此时,
  1. # /etc/init.d/lighttpd start
  2. 2008-01-03 08:55:41: (configfile.c.855) source: /etc/lighttpd/mod_fastcgi.conf line: 28 pos: 1 parser failed somehow near here: )
  3. 2008-01-03 08:55:41: (configfile.c.855) source: /etc/lighttpd/lighttpd.conf line: 51 pos: 16 parser failed somehow near here: (EOL)
复制代码


  1. # cat /etc/lighttpd/mod_fastcgi.conf
  2. ###############################################################################
  3. # mod_fastcgi.conf
  4. # include'd by lighttpd.conf.
  5. # $Header: /var/cvsroot/gentoo-x86/www-servers/lighttpd/files/conf/mod_fastcgi.conf-1.4.13-r2,v 1.1 2007/04/01 23:22:00 robbat2 Exp $
  6. ###############################################################################

  7. #server.modules += ("mod_fastcgi")
  8. #fastcgi.server = ( ".php" =>
  9. #                           ( "localhost" =>
  10. #                                   (
  11. #                                           "socket"            =>              "/var/run/lighttpd/lighttpd-fastcgi-php-" + PID + ".socket",
  12. #                                           "bin-path"  =>              "/usr/bin/php-cgi"
  13. #                                   )
  14. #                           )
  15. #                   )

  16. server.modules += ("mod_fastcgi")
  17. fastcgi.server = ( ".php" =>
  18.    ( "localhost" =>
  19.      (
  20.        "host"     => "127.0.0.1",
  21.        "port"     => 1026,
  22.        "bin-path" => "/usr/bin/php-cgi"
  23.      )
  24.    )

  25. # vim: set ft=conf foldmethod=marker et :
复制代码
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-1-3 09:03:42 | 显示全部楼层
原来是少了个括号……
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-1-3 09:48:45 | 显示全部楼层
php没有问题了,但是wordpress仍然无法运行
回复 支持 反对

使用道具 举报

发表于 2008-1-8 09:57:26 | 显示全部楼层
在 make.conf 的 USE 里面加 cgi fastcgi 重新编译 lighttpd 和 php ,我这里运行wordpress没问题
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-1-8 11:07:17 | 显示全部楼层
Post by keelort;1804292
在 make.conf 的 USE 里面加 cgi fastcgi 重新编译 lighttpd 和 php ,我这里运行wordpress没问题

  1. # eix -e php
  2. [i] dev-lang/php
  3.      Available versions:  
  4.         (4)     [M]4.4.8_pre20070816
  5.         (5)     5.2.4_pre200708051230-r2 5.2.5 5.2.5-r1
  6.         {adabas apache2 bcmath berkdb birdstep bzip2 calendar cdb cgi cjk cli concurrentmodphp crypt ctype curl curlwrappers db2 dbase dbmaker dbx debug discard-path doc empress empress-bcs esoob exif expat fastbuild fdftk filepro filter firebird flatfile force-cgi-redirect frontbase ftp gd gd-external gdbm gmp hash hyperwave-api iconv imap informix inifile interbase iodbc ipv6 java-external java-internal json kerberos ldap ldap-sasl libedit mcal mcve memlimit mhash ming mnogosearch msql mssql mysql mysqli ncurses nls oci8 oci8-instant-client odbc oracle7 overload pcntl pcre pdo pfpro pic posix postgres qdbm readline recode reflection sapdb session sharedext sharedmem simplexml snmp soap sockets solid spell spl sqlite ssl suhosin sybase sybase-ct sysvipc threads tidy tokenizer truetype unicode wddx xml xmlreader xmlrpc xmlwriter xpm xsl yaz zip zip-external zlib}
  7.      Installed versions:  5.2.5-r1(5)(03:27:02 PM 01/02/2008)(apache2 berkdb bzip2 cgi cjk cli crypt ctype exif gdbm iconv ipv6 kerberos ldap mysql ncurses nls pcre readline reflection session sockets spell spl ssl threads tidy truetype unicode xml zlib -adabas -bcmath -birdstep -calendar -cdb -concurrentmodphp -curl -curlwrappers -db2 -dbase -dbmaker -debug -discard-path -doc -empress -empress-bcs -esoob -fastbuild -fdftk -filter -firebird -flatfile -force-cgi-redirect -frontbase -ftp -gd -gd-external -gmp -hash -imap -inifile -interbase -iodbc -java-external -json -ldap-sasl -libedit -mcve -mhash -msql -mssql -mysqli -oci8 -oci8-instant-client -odbc -pcntl -pdo -pic -posix -postgres -qdbm -recode -sapdb -sharedext -sharedmem -simplexml -snmp -soap -solid -sqlite -suhosin -sybase -sybase-ct -sysvipc -tokenizer -wddx -xmlreader -xmlrpc -xmlwriter -xpm -xsl -yaz -zip -zip-external)
复制代码

  1. # eix -e lighttpd
  2. [i] www-servers/lighttpd
  3.      Available versions:  1.3.16 1.4.16 1.4.18 {bzip2 doc fam fastcgi gdbm ipv6 ldap lua memcache minimal mysql pcre php rrdtool ssl test webdav xattr}
  4.      Installed versions:  1.4.18(03:50:14 PM 01/02/2008)(fam fastcgi gdbm ipv6 ldap minimal mysql pcre php ssl -bzip2 -doc -lua -memcache -rrdtool -test -webdav -xattr)
  5.      Homepage:            http://www.lighttpd.net/
  6.      Description:         Lightweight high-performance web server
复制代码
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表