Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Alright, for some reason I've decided to try and get ASP.NET working on OpenBSD, because why not? I've settled on lighttpd as I really mucked up nginx bad and they don't ship mod_mono for Apache either. (FastCGI on Apache is incredibly flaky, especially ancient versions like 1.3 shipped with it!)

Anyways, I've got it semi-working. Right now, it serves non-CGIed content fine, but as soon it gets passed over to FastCGI for Mono to touch it, the request goes into limbo, never to serve a page again.

This is with lighttpd 1.4.32, Mono 2.10.9, and OpenBSD 5.3.

My files:

lighttpd.conf (irreverent, commented bits of config snipped)

# lighttpd configuration file

############ Options you really have to take care of ####################

## modules to load
# at least mod_access and mod_accesslog should be loaded
# all other module should only be loaded if really neccesary
# - saves some time
# - saves memory
server.modules              = (
#                               "mod_rewrite",
#                               "mod_redirect",
#                               "mod_alias",
                                "mod_access",
#                               "mod_trigger_b4_dl",
#                               "mod_auth",
#                               "mod_status",
#                               "mod_setenv",
                                "mod_fastcgi",
#                               "mod_proxy",
#                               "mod_simple_vhost",
#                               "mod_evhost",
#                               "mod_userdir",
#                               "mod_cgi",
#                               "mod_compress",
#                               "mod_ssi",
#                               "mod_usertrack",
#                               "mod_expire",
#                               "mod_secdownload",
#                               "mod_rrdtool",
                                "mod_accesslog" )

## A static document-root. For virtual hosting take a look at the
## mod_simple_vhost module.
# server.document-root        = "htdocs/" # chrooted
server.document-root        = "/var/www/htdocs/"

#### accesslog module
#accesslog.filename          = "logs/access.log"

## where to send error-messages to
#server.errorlog             = "logs/error.log"

# files to check for if .../ is requested
index-file.names            = ( "index.html", "index.htm", "default.htm", "Default.aspx" )

server.event-handler = "kqueue"
server.network-backend = "writev"

server.bind = "0.0.0.0"
server.port = "80"

$SERVER["socket"] == "[::]:80" { }

# mimetype mapping
mimetype.assign             = (
  ".pdf"          =>      "application/pdf",
  ".sig"          =>      "application/pgp-signature",
  ".spl"          =>      "application/futuresplash",
  ".class"        =>      "application/octet-stream",
  ".ps"           =>      "application/postscript",
  ".torrent"      =>      "application/x-bittorrent",
  ".dvi"          =>      "application/x-dvi",
  ".gz"           =>      "application/x-gzip",
  ".pac"          =>      "application/x-ns-proxy-autoconfig",
  ".swf"          =>      "application/x-shockwave-flash",
  ".tar.gz"       =>      "application/x-tgz",
  ".tgz"          =>      "application/x-tgz",
  ".tar"          =>      "application/x-tar",
  ".zip"          =>      "application/zip",
  ".mp3"          =>      "audio/mpeg",
  ".m3u"          =>      "audio/x-mpegurl",
  ".wma"          =>      "audio/x-ms-wma",
  ".wax"          =>      "audio/x-ms-wax",
  ".ogg"          =>      "application/ogg",
  ".wav"          =>      "audio/x-wav",
  ".gif"          =>      "image/gif",
  ".jar"          =>      "application/x-java-archive",
  ".jpg"          =>      "image/jpeg",
  ".jpeg"         =>      "image/jpeg",
  ".png"          =>      "image/png",
  ".xbm"          =>      "image/x-xbitmap",
  ".xpm"          =>      "image/x-xpixmap",
  ".xwd"          =>      "image/x-xwindowdump",
  ".css"          =>      "text/css",
  ".html"         =>      "text/html",
  ".htm"          =>      "text/html",
  ".js"           =>      "text/javascript",
  ".asc"          =>      "text/plain",
  ".c"            =>      "text/plain",
  ".cpp"          =>      "text/plain",
  ".log"          =>      "text/plain",
  ".conf"         =>      "text/plain",
  ".text"         =>      "text/plain",
  ".txt"          =>      "text/plain",
  ".dtd"          =>      "text/xml",
  ".xml"          =>      "text/xml",
  ".mpeg"         =>      "video/mpeg",
  ".mpg"          =>      "video/mpeg",
  ".mov"          =>      "video/quicktime",
  ".qt"           =>      "video/quicktime",
  ".avi"          =>      "video/x-msvideo",
  ".asf"          =>      "video/x-ms-asf",
  ".asx"          =>      "video/x-ms-asf",
  ".wmv"          =>      "video/x-ms-wmv",
  ".bz2"          =>      "application/x-bzip",
  ".tbz"          =>      "application/x-bzip-compressed-tar",
  ".tar.bz2"      =>      "application/x-bzip-compressed-tar",
  # default mime type
  ""              =>      "application/octet-stream",
 )

## deny access the file-extensions
#
# ~    is for backupfiles from vi, emacs, joe, ...
# .inc is often used for code includes which should in general not be part
#      of the document-root
url.access-deny             = ( "~", ".inc" )

$HTTP["url"] =~ "\.pdf$" {
  server.range-requests = "disable"
}

##
# which extensions should not be handle via static-file transfer
#
# .php, .pl, .fcgi are most often handled by mod_fastcgi or mod_cgi
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )

######### Options that are good to be but not neccesary to be changed #######

## to help the rc.scripts
server.pid-file            = "/var/run/lighttpd.pid"

# chroot() to directory (BREAKS MONO)
#server.chroot              = "/var/www/"

server.username            = "_lighttpd"
server.groupname           = "_lighttpd"

# ASP.NET

# 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" )

### The directory that contains your Mono installation.
# The "bin" subdir will be added to the PATH and the "lib" subdir will be
# added to the LD_LIBRARY_PATH.
# For a typical system-wide installation on Linux, use:
var.mono_dir = "/usr/local/"
# For an installation in a user account (lighttpd need read/exec access):
#var.mono_dir = "/home/username/mono-1.2.6/"

### 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"
# For ASP.NET 4.0 support use:
var.mono_fastcgi_server = mono_dir + "bin/" + "fastcgi-mono-server4"
### 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 = "/:."

fastcgi.server = (
        ".aspx" => ((
                "socket" => mono_shared_dir + "fastcgi-mono-server",
                "bin-path" => mono_fastcgi_server,
                "bin-environment" => (
                        "PATH" => "/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:" + 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" => mono_fcgi_root,
                        "MONO_FCGI_APPLICATIONS" => mono_fcgi_applications
                ),
                "max-procs" => 1,
                "check-local" => "disable"
        ))
)

# Handle ASP.NET files
fastcgi.map-extensions = (
        ".asmx"   => ".aspx",
        ".ashx"   => ".aspx",
        ".asax"   => ".aspx",
        ".ascx"   => ".aspx",
        ".soap"   => ".aspx",
        ".rem"    => ".aspx",
        ".axd"    => ".aspx",
        ".cs"     => ".aspx",
        ".config" => ".aspx",
        ".dll"    => ".aspx"
)

Default.aspx (living amongst the default documents in /var/www/htdocs)

<!doctype html>
<html>
        <head>
                <title>lolapache</title>
        </head>
        <body>
                <% Response.Write("Hello from ASP.NET"); %>
        </body>
</html>
share|improve this question
    
IIRC you made a ktrace/kdump but never shared it in our irc channel... –  Stefan May 4 '13 at 15:57
    
I was getting busy, and I forgot. Where should I dump this ktrace? (At this point though, I think it may be up to Mono) –  Calvin B May 5 '13 at 13:18
    
I think the policy here is to append it to the question in code tags, and not using an external pastebin (the readable kdump output ofc, not the binary ktrace) –  Stefan May 6 '13 at 11:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.