使用Lighttpd的rewrite模块支持Drupal/WordPress的Clean URLS

本文介绍如何在Lighttpd服务器上配置Drupal和WordPress以实现简洁链接功能。通过修改配置文件并添加特定的RewriteRule,使得在不使用Apache的情况下也能实现链接美化。

 

  原来使用Apache2.2,只要开启使用rewrite模块,在Drupal中:管理(admin)-站点设置(settings)-简洁链接 (Clean URLS)里,Drupal会自动检测可以使用简介链接,选择启用(enable),就会使用默认的.htaccess文件来完成简洁链接的功能。
  但是,当我把Apache2.2换为Lighttpd1.4.xx后,Drupal无法自动检测是否可以使用简洁链接功能。google一阵,发现解决的方法其实很简单。
  首先,修改Lighttpd配置文件,比如我使用Lighttpd目录下的conf/lighttpd-inc.conf配置文件,那么就修改这个文件,开启rewrite模块:

server.modules  =  (
### 其他模块

### rewrite模块
" mod_rewrite "
)


  参考Drupal默认的.htaccess文件里rewrite模块部分:

<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?q
= $ 1   [ L,QSA ]
</IfModule>


  看到没有,只有一条RewriteRule,就是它了。那么怎么样把它“移植”到Lighttpd的配置文件里呢?很简单,在Lighttpd配置文件里添加:

#### url handling modules (rewrite ,  redirect ,  access)
url.rewrite 
=  (  " ^/cms/(.*)$ "   = " /cms/index.php?q=$1 "  )


  然后进入Drupal目录,修改sites/default/settings.php文件,在末尾处添加:

/**
* Clean URL
**/
$conf
[ 'clean_url' ] = 1 ;


  现在访问http://wind/cms/,发现大部分功能都正常,比如用户登录。但是页面很粗糙,多媒体文件(图片什么的)和CSS排版都 没有加载,于是还需要增加一个RewriteRule,放在"^/cms/(.*)$" => "/cms/index.php?q=$1"的前面,现在的RewriteRule配置是这样子的:

#### url handling modules (rewrite ,  redirect ,  access)
url.rewrite 
=  (  " ^/cms/(.*.gif|.*.png|.*.jpg|.*.pdf|.*.js|.*.css) "   = " /cms/$1 " ,   " ^/cms/(.*)$ "   = " /cms/index.php?q=$1 "  )


  现在访问http://wind/cms/,一切正常了哦!
  WordPress的设置就更加简单了,依然查看WordPress 目录下的.htaccess文件,查看Apache下WordPress的RewriteRule,在Lighttpd的rewrite模块配置里添加一 条RewriteRule,最后Drupal/WordPress的rewrite模块配置是类似这样子的:

#### url handling modules (rewrite ,  redirect ,  access)
url.rewrite 
=  (  " ^/blog/(archives|categories|comments|feed)/ "   = " /blog/index.php " ,   " ^/cms/(.*.gif|.*.png|.*.jpg|.*.pdf|.*.js|.*.css) "   = " /cms/$1 " ,   " ^/cms/(.*)$ "   = " /cms/index.php?q=$1 "  )


  哈哈,是不是很简单呢?不过要注意,在rewrite模块配置之前请不要设置server.error-handler-404,不然只显示404错误哦~
   (注:我是在公司局域网里架设的服务器,主机域名为http://wind/,www根目录为G:\pub。WinXP下Apache2 /Lighttpd+PHP5+MySQL5做服务器。Lighttpd使用FastCGI。Drupal目录为G:\pub \cms,WordPress目录为G:\pub\blog。)

ERROR: /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd_1.4.74.bb: Unable to get checksum for lighttpd SRC_URI entry lighttpd-custom.conf: file could not be found The following paths were searched: /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd-1.4.74/tdx-distro/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd/tdx-distro/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/files/tdx-distro/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd-1.4.74/tdx-xwayland/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd/tdx-xwayland/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/files/tdx-xwayland/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd-1.4.74/verdin-imx8mm/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd/verdin-imx8mm/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/files/verdin-imx8mm/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd-1.4.74/mx8mm-nxp-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd/mx8mm-nxp-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/files/mx8mm-nxp-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd-1.4.74/mx8mm-generic-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd/mx8mm-generic-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/files/mx8mm-generic-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd-1.4.74/mx8m-nxp-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd/mx8m-nxp-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/files/mx8m-nxp-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd-1.4.74/mx8m-generic-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd/mx8m-generic-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/files/mx8m-generic-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd-1.4.74/mx8-nxp-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd/mx8-nxp-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/files/mx8-nxp-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd-1.4.74/mx8-generic-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd/mx8-generic-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/files/mx8-generic-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd-1.4.74/imxgpu3d/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd/imxgpu3d/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/files/imxgpu3d/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd-1.4.74/imxgpu2d/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd/imxgpu2d/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/files/imxgpu2d/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd-1.4.74/imxviv/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd/imxviv/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/files/imxviv/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd-1.4.74/imxgpu/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd/imxgpu/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/files/imxgpu/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd-1.4.74/imxvpu/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd/imxvpu/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/files/imxvpu/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd-1.4.74/imxdrm/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd/imxdrm/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/files/imxdrm/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd-1.4.74/imx-nxp-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd/imx-nxp-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/files/imx-nxp-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd-1.4.74/imx-generic-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd/imx-generic-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/files/imx-generic-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd-1.4.74/tdx/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd/tdx/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/files/tdx/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd-1.4.74/use-nxp-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd/use-nxp-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/files/use-nxp-bsp/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd-1.4.74/armv8a/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd/armv8a/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/files/armv8a/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd-1.4.74/aarch64/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd/aarch64/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/files/aarch64/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd-1.4.74/aarch64/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd/aarch64/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/files/aarch64/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd-1.4.74/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/lighttpd/lighttpd-custom.conf /home/louie/oe-core/build/../layers/openembedded-core/meta/recipes-extended/lighttpd/files/lighttpd-custom.conf ERROR: Parsing halted due to errors, see error messages above
09-15
解释一下这个 rstrip.sh: /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/lighttpd-1.4.71/ipkg-model_brcm_bcm490x/lighttpd-mod-openssl/usr/lib/mod_openssl.so:shared object ( echo "Package: lighttpd-mod-openssl"; echo "Version: 1.4.71-1"; DEPENDS=''; for depend in lighttpd libopenssl; do DEPENDS=${DEPENDS:+$DEPENDS, }${depend##+}; done; echo "Depends: $DEPENDS"; echo "Provides: "; echo "Source: /data/red-round3/red-round3/Iplatform/packages/opensource/lighttpd"; echo "Section: net"; echo "Status: unknown ok not-installed"; echo "Essential: no"; echo "Priority: optional"; echo "Maintainer: OpenWrt Developers Team <openwrt-devel@openwrt.org>"; echo "Architecture: model_brcm_bcm490x"; echo "Installed-Size: 0"; echo -n "Description: "; . /data/red-round3/red-round3/Iplatform/openwrt/include/shell.sh; getvar V_Package_lighttpd_mod_openssl_description | sed -e 's,^[[:space:]]*, ,g'; ) > /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/lighttpd-1.4.71/ipkg-model_brcm_bcm490x/lighttpd-mod-openssl/CONTROL/control chmod 644 /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/lighttpd-1.4.71/ipkg-model_brcm_bcm490x/lighttpd-mod-openssl/CONTROL/control . /data/red-round3/red-round3/Iplatform/openwrt/include/shell.sh; (cd /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/lighttpd-1.4.71/ipkg-model_brcm_bcm490x/lighttpd-mod-openssl/CONTROL; var2file "V_Package_lighttpd_mod_openssl_conffiles" conffiles; ) ipkg-build -c -o 0 -g 0 /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/lighttpd-1.4.71/ipkg-model_brcm_bcm490x/lighttpd-mod-openssl /data/red-round3/red-round3/Iplatform/openwrt/bin/model_brcm_bcm490x-be220v1/packages /data/red-round3/red-round3/Iplatform/openwrt/staging_dir/host/bin/find: '/data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/lighttpd-1.4.71/ipkg-model_brcm_bcm490x/lighttpd-mod-openssl/etc/lighttpd/conf.d/30-openssl.conf': No such file or directory mv: cannot stat 'CONTROL/conffiles.resolved': No such file or directory chmod: cannot access 'CONTROL/conffiles': No such file or directory Packaged contents of /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/lighttpd-1.4.71/ipkg-model_brcm_bcm490x/lighttpd-mod-openssl into /data/red-round3/red-round3/Iplatform/openwrt/bin/model_brcm_bcm490x-be220v1/packages/lighttpd-mod-openssl_1.4.71-1_model_brcm_bcm490x.ipk rm -rf /data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/root-model_brcm_bcm490x/tmp-lighttpd-mod-openssl mkdir -p /data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/root-model_brcm_bcm490x/stamp /data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/root-model_brcm_bcm490x/tmp-lighttpd-mod-openssl install -d -m0755 /data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/root-model_brcm_bcm490x/tmp-lighttpd-mod-openssl/usr/lib/lighttpd cp -fpR /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/lighttpd-1.4.71/src/.libs/mod_openssl.so /data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/root-model_brcm_bcm490x/tmp-lighttpd-mod-openssl/usr/lib install -d -m0755 /data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/root-model_brcm_bcm490x/tmp-lighttpd-mod-openssl/etc/lighttpd/conf.d if [ -f ./files/openssl.conf ]; then cp -fpR ./files/openssl.conf /data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/root-model_brcm_bcm490x/tmp-lighttpd-mod-openssl/etc/lighttpd/conf.d/30-openssl.conf ; if ! grep -qF 'mod_openssl' /data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/root-model_brcm_bcm490x/tmp-lighttpd-mod-openssl/etc/lighttpd/conf.d/30-openssl.conf; then sed -i "`sed '/^##/ !q' /data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/root-model_brcm_bcm490x/tmp-lighttpd-mod-openssl/etc/lighttpd/conf.d/30-openssl.conf | wc -l` i server.modules += ( \"mod_openssl\" )" /data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/root-model_brcm_bcm490x/tmp-lighttpd-mod-openssl/etc/lighttpd/conf.d/30-openssl.conf ; fi fi SHELL= /data/red-round3/red-round3/Iplatform/openwrt/staging_dir/host/bin/flock /data/red-round3/red-round3/Iplatform/openwrt/tmp/.root-copy.flock -c 'cp -fpR /data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/root-model_brcm_bcm490x/tmp-lighttpd-mod-openssl/. /data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/root-model_brcm_bcm490x/' rm -rf /data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/root-model_brcm_bcm490x/tmp-lighttpd-mod-openssl touch /data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/root-model_brcm_bcm490x/stamp/.lighttpd-mod-openssl_installed mkdir -p /data/red-round3/red-round3/Iplatform/openwrt/bin/model_brcm_bcm490x-be220v1/packages /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/lighttpd-1.4.71/ipkg-model_brcm_bcm490x/lighttpd-mod-webdav/CONTROL /data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/pkginfo install -d -m0755 /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/lighttpd-1.4.71/ipkg-model_brcm_bcm490x/lighttpd-mod-webdav/usr/lib/lighttpd cp -fpR /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/lighttpd-1.4.71/src/.libs/mod_webdav.so /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/lighttpd-1.4.71/ipkg-model_brcm_bcm490x/lighttpd-mod-webdav/usr/lib install -d -m0755 /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/lighttpd-1.4.71/ipkg-model_brcm_bcm490x/lighttpd-mod-webdav/etc/lighttpd/conf.d if [ -f ./files/webdav.conf ]; then cp -fpR ./files/webdav.conf /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/lighttpd-1.4.71/ipkg-model_brcm_bcm490x/lighttpd-mod-webdav/etc/lighttpd/conf.d/30-webdav.conf ; if ! grep -qF 'mod_webdav' /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/lighttpd-1.4.71/ipkg-model_brcm_bcm490x/lighttpd-mod-webdav/etc/lighttpd/conf.d/30-webdav.conf; then sed -i "`sed '/^##/ !q' /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/lighttpd-1.4.71/ipkg-model_brcm_bcm490x/lighttpd-mod-webdav/etc/lighttpd/conf.d/30-webdav.conf | wc -l` i server.modules += ( \"mod_webdav\" )" /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/lighttpd-1.4.71/ipkg-model_brcm_bcm490x/lighttpd-mod-webdav/etc/lighttpd/conf.d/30-webdav.conf ; fi fi find /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/lighttpd-1.4.71/ipkg-model_brcm_bcm490x/lighttpd-mod-webdav -name 'CVS' -o -name '.svn' -o -name '.#*' -o -name '*~'| xargs -r rm -rf export CROSS="arm-buildroot-linux-gnueabi-" ; NM="arm-buildroot-linux-gnueabi-nm" STRIP="arm-buildroot-linux-gnueabi-strip --strip-all" STRIP_KMOD="/data/red-round3/red-round3/Iplatform/openwrt/scripts/strip-kmod.sh" /data/red-round3/red-round3/Iplatform/openwrt/scripts/rstrip.sh /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/lighttpd-1.4.71/ipkg-model_brcm_bcm490x/lighttpd-mod-webdav rstrip.sh: /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/lighttpd-1.4.71/ipkg-model_brcm_bcm490x/lighttpd-mod-webdav/usr/lib/mod_webdav.so:shared object ( echo "Package: lighttpd-mod-webdav"; echo "Version: 1.4.71-1"; DEPENDS=''; for depend in lighttpd libsqlite3 libuuid libxml2; do DEPENDS=${DEPENDS:+$DEPENDS, }${depend##+}; done; echo "Depends: $DEPENDS"; echo "Provides: "; echo "Source: /data/red-round3/red-round3/Iplatform/packages/opensource/lighttpd"; echo "Section: net"; echo "Status: unknown ok not-installed"; echo "Essential: no"; echo "Priority: optional"; echo "Maintainer: OpenWrt Developers Team <openwrt-devel@openwrt.org>"; echo "Architecture: model_brcm_bcm490x"; echo "Installed-Size: 0"; echo -n "Description: "; . /data/red-round3/red-round3/Iplatform/openwrt/include/shell.sh; getvar V_Package_lighttpd_mod_webdav_description | sed -e 's,^[[:space:]]*, ,g'; ) > /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/lighttpd-1.4.71/ipkg-model_brcm_bcm490x/lighttpd-mod-webdav/CONTROL/control chmod 644 /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/lighttpd-1.4.71/ipkg-model_brcm_bcm490x/lighttpd-mod-webdav/CONTROL/control . /data/red-round3/red-round3/Iplatform/openwrt/include/shell.sh; (cd /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/lighttpd-1.4.71/ipkg-model_brcm_bcm490x/lighttpd-mod-webdav/CONTROL; var2file "V_Package_lighttpd_mod_webdav_conffiles" conffiles; ) ipkg-build -c -o 0 -g 0 /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/lighttpd-1.4.71/ipkg-model_brcm_bcm490x/lighttpd-mod-webdav /data/red-round3/red-round3/Iplatform/openwrt/bin/model_brcm_bcm490x-be220v1/packages /data/red-round3/red-round3/Iplatform/openwrt/staging_dir/host/bin/find: '/data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/lighttpd-1.4.71/ipkg-model_brcm_bcm490x/lighttpd-mod-webdav/etc/lighttpd/conf.d/30-webdav.conf': No such file or directory mv: cannot stat 'CONTROL/conffiles.resolved': No such file or directory chmod: cannot access 'CONTROL/conffiles': No such file or directory Packaged contents of /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/lighttpd-1.4.71/ipkg-model_brcm_bcm490x/lighttpd-mod-webdav into /data/red-round3/red-round3/Iplatform/openwrt/bin/model_brcm_bcm490x-be220v1/packages/lighttpd-mod-webdav_1.4.71-1_model_brcm_bcm490x.ipk rm -rf /data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/root-model_brcm_bcm490x/tmp-lighttpd-mod-webdav mkdir -p /data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/root-model_brcm_bcm490x/stamp /data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/root-model_brcm_bcm490x/tmp-lighttpd-mod-webdav install -d -m0755 /data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/root-model_brcm_bcm490x/tmp-lighttpd-mod-webdav/usr/lib/lighttpd cp -fpR /data/red-round3/red-round3/Iplatform/openwrt/build_dir/target-arm-openwrt-linux-uclibc-be220v1/lighttpd-1.4.71/src/.libs/mod_webdav.so /data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/root-model_brcm_bcm490x/tmp-lighttpd-mod-webdav/usr/lib install -d -m0755 /data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/root-model_brcm_bcm490x/tmp-lighttpd-mod-webdav/etc/lighttpd/conf.d if [ -f ./files/webdav.conf ]; then cp -fpR ./files/webdav.conf /data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/root-model_brcm_bcm490x/tmp-lighttpd-mod-webdav/etc/lighttpd/conf.d/30-webdav.conf ; if ! grep -qF 'mod_webdav' /data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/root-model_brcm_bcm490x/tmp-lighttpd-mod-webdav/etc/lighttpd/conf.d/30-webdav.conf; then sed -i "`sed '/^##/ !q' /data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/root-model_brcm_bcm490x/tmp-lighttpd-mod-webdav/etc/lighttpd/conf.d/30-webdav.conf | wc -l` i server.modules += ( \"mod_webdav\" )" /data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/root-model_brcm_bcm490x/tmp-lighttpd-mod-webdav/etc/lighttpd/conf.d/30-webdav.conf ; fi fi SHELL= /data/red-round3/red-round3/Iplatform/openwrt/staging_dir/host/bin/flock /data/red-round3/red-round3/Iplatform/openwrt/tmp/.root-copy.flock -c 'cp -fpR /data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/root-model_brcm_bcm490x/tmp-lighttpd-mod-webdav/. /data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/root-model_brcm_bcm490x/' rm -rf /data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/root-model_brcm_bcm490x/tmp-lighttpd-mod-webdav touch /data/red-round3/red-round3/Iplatform/openwrt/staging_dir/target-arm-openwrt-linux-uclibc-be220v1/root-model_brcm_bcm490x/stamp/.lighttpd-mod-webdav_installed make[3]: Leaving directory '/data/red-round3/red-round3/Iplatform/packages/opensource/lighttpd' make[2]: Leaving directory '/data/red-round3/red-round3/Iplatform/openwrt' make[1]: Leaving directory '/data/red-round3/red-round3/Iplatform/openwrt'
09-27
【电力系统】单机无穷大电力系统短路故障暂态稳定Simulink仿真(带说明文档)内容概要:本文档围绕“单机无穷大电力系统短路故障暂态稳定Simulink仿真”展开,提供了完整的仿真模型与说明文档,重点研究电力系统在发生短路故障后的暂态稳定性问题。通过Simulink搭建单机无穷大系统模型,模拟不同类型的短路故障(如三相短路),分析系统在故障期间及切除后的动态响应,包括发电机转子角度、转速、电压和功率等关键参数的变化,进而评估系统的暂态稳定能力。该仿真有助于理解电力系统稳定性机理,掌握暂态过程分析方法。; 适合人群:电气工程及相关专业的本科生、研究生,以及从事电力系统分析、运行与控制工作的科研人员和工程师。; 使用场景及目标:①学习电力系统暂态稳定的基本概念与分析方法;②掌握利用Simulink进行电力系统建模与仿真的技能;③研究短路故障对系统稳定性的影响及提高稳定性的措施(如故障清除时间优化);④辅助课程设计、毕业设计或科研项目中的系统仿真验证。; 阅读建议:建议结合电力系统稳定性理论知识进行学习,先理解仿真模型各模块的功能与参数设置,再运行仿真并仔细分析输出结果,尝试改变故障类型或系统参数以观察其对稳定性的影响,从而深化对暂态稳定问题的理解。
本研究聚焦于运用MATLAB平台,将支持向量机(SVM)应用于数据预测任务,并引入粒子群优化(PSO)算法对模型的关键参数进行自动调优。该研究属于机器学习领域的典型实践,其核心在于利用SVM构建分类模型,同时借助PSO的全局搜索能力,高效确定SVM的最优超参数配置,从而显著增强模型的整体预测效能。 支持向量机作为一种经典的监督学习方法,其基本原理是通过在高维特征空间中构造一个具有最大间隔的决策边界,以实现对样本数据的分类或回归分析。该算法擅长处理小规模样本集、非线性关系以及高维度特征识别问题,其有效性源于通过核函数将原始数据映射至更高维的空间,使得原本复杂的分类问题变得线性可分。 粒子群优化算法是一种模拟鸟群社会行为的群体智能优化技术。在该算法框架下,每个潜在解被视作一个“粒子”,粒子群在解空间中协同搜索,通过不断迭代更新自身速度与位置,并参考个体历史最优解和群体全局最优解的信息,逐步逼近问题的最优解。在本应用中,PSO被专门用于搜寻SVM中影响模型性能的两个关键参数——正则化参数C与核函数参数γ的最优组合。 项目所提供的实现代码涵盖了从数据加载、预处理(如标准化处理)、基础SVM模型构建到PSO优化流程的完整步骤。优化过程会针对不同的核函数(例如线性核、多项式核及径向基函数核等)进行参数寻优,并系统评估优化前后模型性能的差异。性能对比通常基于准确率、精确率、召回率及F1分数等多项分类指标展开,从而定量验证PSO算法在提升SVM模型分类能力方面的实际效果。 本研究通过一个具体的MATLAB实现案例,旨在演示如何将全局优化算法与机器学习模型相结合,以解决模型参数选择这一关键问题。通过此实践,研究者不仅能够深入理解SVM的工作原理,还能掌握利用智能优化技术提升模型泛化性能的有效方法,这对于机器学习在实际问题中的应用具有重要的参考价值。 资源来源于网络分享,仅用于学习交流使用,请勿用于商业,如有侵权请联系我删除!
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值