Lighttpdでvhost

あ〜〜NginxだとバーチャルホストでCGIがうまくいかんw
なので、Lighttpdでお願いしました。。。

特に難しいことはなかったのですが、
いろいろとハマってしまいました。。。

OS・・・Scientific Linux
lighttpd・・・1.4.28

Virtual host・・・hogehoge.com
Document Root・・・/var/www/vhosts/hogehoge.com/
vhost Conf・・・hogehoge.com.conf


1)VHOST毎のConf読み込み

# vi /etc/lighttpd/lighttpd.conf

include_shell "cat /etc/lighttpd/vhosts.d/*.conf"

上記だとVHOST毎の設定ファイル名は、
〜〜.conf以外読まないので気をつけてください

2)VHOSTの設定

# vi /etc/lighttpd/vhosts.d/hogehoge.com.conf

$HTTP["host"] == "hogehoge.com" {
  server.document-root = "/var/www/vhosts/hogehoge.com/"
}

他のオプションもここで設定できます。

今回は、これだけで動かすことにしました。
特に問題もなくw

番外)CGIを有効

# vi /etc/lighttpd/modules.conf

server.modules = (

  "mod_cgi"

)

実はこれが僕のメインでしたw
cgiを動かしたかっただけですw

CGIとか動かすと、以下のエラーが出る場合があります。

(plugin.c.131) Cannot load plugin mod_cgi more than once, please fix your config (we may not accept such configs in future releases

解決方法は2つ

1つめ

# vi /etc/lighttpd/modules.conf

server.modules = (

#  "mod_cgi"


##
## plain old CGI (mod_cgi)
##
include "conf.d/cgi.conf"
)
# vi /etc/lighttpd/conf.d/cgi.conf

server.modules += ( "mod_cgi" )

2つめ

# vi /etc/lighttpd/modules.conf

server.modules = (

  "mod_cgi"


##
## plain old CGI (mod_cgi)
##
include "conf.d/cgi.conf"
)
# vi /etc/lighttpd/conf.d/cgi.conf

#server.modules += ( "mod_cgi" )

見たとおり、モジュールを2重に呼んでいるためです。
おそらく他の場合も同じようなエラーが出ると思います。

[tegaki]疲れたぁww[/tegaki]

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

Enter code * Time limit is exhausted. Please reload CAPTCHA.

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください