xsp
xspとは、MonoプロジェクトおよびGNOMEプロジェクトによりオープンソースで開発が行われているWebアプリケーションサーバー(Webサーバー)である。
概要
マイクロソフトがWindows向けに開発・提供しているWebアプリケーション・フレームワークであるASP.NETおよびASP.NET MVCを、LinuxやFreeBSD、Mac OS Xなどの様々なOS上で動かすことを主目的としている。
XSP自体は、MonoおよびC#を用いて開発されており、Monoが動作する環境であればOSを問わず動作する。なお、Windows上であればマイクロソフト製のランタイムライブラリ(.NET Framework)でも動作する。さらにUNIX拡張機能を用いることでWindows上では動作しなくなるが、UNIX系OS固有の機能を用いたWebシステムを構築することも可能となっている。
XSPは安定して動作するため単体のWebサーバーとして用いることも可能である。ただし、マイクロソフトのInternet Information Services(IIS)ほどWebサーバーとしての汎用性は追求していない。このため別途Webサーバーなどと連携させて動作させることができ、例えばApache HTTP Serverではmod_monoモジュールを用いて連携を行う。
MonoDevelopを用いてASP.NETおよびASP.NET MVCを用いたWebアプリケーションを開発する際に、バックグラウンドで一時的に起動するデバッグ用のWebサーバーとしても用いられている。
使い方
コマンドライン
ASP.NETやASP.NET MVCで書いたWebアプリを格納したディレクトリに移動してxpsを立ち上げる。 Webアプリが使っている.NET Frameworkのバージョンごとにxsp、xsp2、xsp4と別々のコマンドになっている。 .NET Framework 3.xは.NET Framework 2.xのマイナーチェンジなので欠番である(xsp2を使う)。
なお、.NET Framework 2.x向けに作ったWebアプリをxsp4で動かしてもほぼ動く。
$ cd /hoge/OreOreWebApp
$ /usr/local/bin/xsp4
Apacheと連携
mod_mono#設定例の項目を参照。
コマンドライン
ASP.NETやASP.NET MVCのWebアプリを格納したディレクトリに移動して以下のコマンドを打つ。
$ xsp4
デフォルトではポート番号8080で起動するので、変更したい場合は以下のようにする。
$ xsp4 --port 80
usage
--port N: n is the tcp port to listen on. Default value: 8080 AppSettings key name: MonoServerPort --random-port: listen on a randomly assigned port. The port numer will be reported to the caller via a text file. --address addr: addr is the ip address to listen on. Default value: 0.0.0.0 AppSettings key name: MonoServerAddress --https: enable SSL for the server Default value: false. AppSettings key name: --https-client-accept: enable SSL for the server with optional client certificates Default value: false (non-ssl). AppSettings key name: --https-client-require: enable SSL for the server with mandatory client certificates Default value: false (non-ssl). AppSettings key name: --cert FILENAME: path to X.509 certificate file (cer) AppSettings key name: --pkfile FILENAME: path to private key file (pvk) AppSettings key name: --p12file FILENAME: path to a PKCS#12 file containing the certificate and the private AppSettings key name: --pkpwd PASSWORD: password to decrypt the private key AppSettings key name: --protocol: specify which protocols are available for SSL Possible values: Default, Tls, Ssl2, Ssl3 Default value: Default (all) AppSettings key name: --root rootdir: the server changes to this directory before anything else. Default value: current directory. AppSettings key name: MonoServerRootDir --appconfigfile FILENAME: adds application definitions from the XML configuration file. See sample configuration file that comes with the server. AppSettings key name: MonoApplicationsConfigFile --appconfigdir DIR: adds application definitions from all XML files found in the specified directory DIR. Files must have '.webapp' extension AppSettings key name: MonoApplicationsConfigDir --applications APPS: a comma separated list of virtual directory and real directory for all the applications we want to manage with this server. The virtual and real dirs. are separated by a colon. Optionally you may specify virtual host name and a port. [[hostname:]port:]VPath:realpath,... Samples: /:. the virtual / is mapped to the current directory. /blog:../myblog the virtual /blog is mapped to ../myblog myhost.someprovider.net:/blog:../myblog the virtual /blog at myhost.someprovider.net is mapped to ../myblog /:.,/blog:../myblog Two applications like the above ones are handled. Default value: /:. AppSettings key name: MonoApplications --nonstop: don't stop the server by pressing enter. Must be used when the server has no controlling terminal. --no-hidden: allow access to hidden files (see 'man xsp' for details) --version: displays version information and exits. --verbose: prints extra messages. Mainly useful for debugging. --pidfile file: write the process PID to the specified file.