
Mono stellt momentan die einzige Möglichkeit dar, ASP.Net auch unter anderen Systemen wie Windows verwenden zu können. Mittels XSP, einen in C# geschriebenen Webserver können wir Mono als FastCGI zusammen mit Lighttpd verwenden.
Installation
Als erstes wird Mono benötigt. Dies gibt es auf der offiziellen Seite bereits für viele verschiedene Systeme als fertige Binaries oder den Sourcecode zum selberkompilieren. Nach Download der Sourcen folgende Befehle zum kompilieren ausführen:
./configure --prefix=/usr
make
make install
Der Parameter “–prefix” besagt, dass Mono im Verzeichnis “/usr” (/usr/bin, /usr/lib, etc.) installiert wird. Dies kann natürlich je nach belieben geändert werden. Wichtig ist dabei nur, dass Lighttpd ausführrechte auf diese Dateien benötigt.
Nachdem Mono installiert ist, kann auch XSP installiert werden. Auch hier gibt es wieder diverse Binaries oder den Sourcecode. Zum kompilieren wieder die o. g. Befehle ausführen.
Konfiguration
Sollte im Lighttpd noch kein FastCGI aktiviert worden sein, so muss dies nun durch das auskommentieren der entsprechendne Zeile in der Conf-Datei geschehen oder durch hinzufügen folgender Zeile:
server.modules += ( "mod_fastcgi" )
Anschließend die Konfiguration von FastCGI wie folgt vornehmen:
fastcgi.server = (
"" => ((
"socket" => mono_shared_dir + "fastcgi-mono-server",
"bin-path" => mono_fastcgi_server,
"bin-environment" => (
"PATH" => "/bin:/usr/bin:" + mono_dir + "bin",
"LD_LIBRARY_PATH" => mono_dir + "lib:",
"MONO_SHARED_DIR" => mono_shared_dir,
"MONO_FCGI_LOGLEVELS" => "Standard",'
"MONO_FCGI_LOGFILE" => mono_shared_dir + "fastcgi.log",
"MONO_FCGI_ROOT" => "/path/to/www/",
"MONO_FCGI_APPLICATIONS" => mono_fcgi_applications
),
"max-procs" => 1,
"check-local" => "disable"
))
)
Danach noch eine weitere Konfigurationsdatei namens “mono.conf” anlegen mit folgendem Inhalt:
# Add index.aspx and default.aspx to the list of files to check when a
# directory is requested.
index-file.names += ( "index.aspx", "default.aspx" )
### A directory that is writable by the lighttpd process.
# This is where the log file, communication socket, and Mono's .wapi folder
# will be created.
# For a typical system-wide installation on Linux, use:
var.mono_shared_dir = "/tmp/"
# For an installation in a user account (dir must exist and be writable):
#var.mono_shared_dir = "/home/username/lighttpd_scratch/"
### The path to the server to launch to handle FASTCGI requests.
# For ASP.NET 1.1 support use:
#var.mono_fastcgi_server = mono_dir + "bin/" + "fastcgi-mono-server"
# For ASP.NET 2.0 support use:
var.mono_fastcgi_server = mono_dir + "bin/" + "fastcgi-mono-server2"
### The root of your applications
# For apps installed under the lighttpd document root, use:
var.mono_fcgi_root = server.document-root
# For apps installed in a user account, use something like:
#var.mono_fcgi_root = "/home/username/htdocs/"
### Application map
# 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.
var.mono_fcgi_applications = "/:."
Diese Datei muss dann selbstverständlich noch per Include eingebunden werden:
include "conf.d/mono.conf"
Jetzt nur noch den Server neustarten und absofort sollten nun ASP.Net Seiten auf dem Server laufen.
Offizielle Mono Seite
Offizielle LightHttpd Seite
Lighttpd Mono Konfiguration
{ 0 Kommentare } { 0 Shares }