2011-11-01 15 views
7

Durante una semana he intentado que mi configuración mono se ejecute con apache. Debo haber intentado prácticamente cualquier cosa, vergonzosamente no veo cambios, el problema sigue siendo el mismo.Mono + apache2 = Servicio temporalmente no disponible (503)

Cuando intento conectarme al servidor me aparece un error 503: Servicio temporalmente no disponible Cuando echo un vistazo al registro de error, aparece vacío y estoy bastante seguro de que no es un problema de permiso.

sobre Apache:

Package: apache2 
Priority: optional 
Section: httpd 
Installed-Size: 36 
Maintainer: Debian Apache Maintainers <[email protected]> 
Architecture: amd64 
Version: 2.2.16-6+squeeze4 
Depends: apache2-mpm-worker (= 2.2.16-6+squeeze4) | apache2-mpm-prefork (= 2.2.16-6+squeeze4) | apache2-mpm-event (= 2.2.16-6+squeeze4) | apache2-mpm-itk (= 2.2.16-6+squeeze4), apache2.2-common (= 2.2.16-6+squeeze4) 

Acerca de mono:

Package: mono-apache-server2 
Priority: optional 
Section: httpd 
Installed-Size: 260 
Maintainer: Debian Mono Group <[email protected]> 
Architecture: all 
Source: xsp 
Version: 2.6.5-3 
Replaces: mono-server 
Depends: debconf (>= 0.5) | debconf-2.0, mono-runtime (>= 1.1.8.1), libc6 (>= 2.11) | libc6.1 (>= 2.11) | libc0.1 (>= 2.11), libmono-corlib2.0-cil (>= 2.6.3), libmono-posix2.0-cil (>= 2.4), libmono-security2.0-cil (>= 2.6.7), libmono-system-web2.0-cil (>= 1.9.1), libmono-system2.0-cil (>= 2.6.3), mono-xsp2-base (= 2.6.5-3), perl-modules 

estoy usando la configuración más adelante.

<VirtualHost *:80> 
    ServerName myapp.example.com 
    ServerAdmin [email protected] 
    DirectoryIndex index.html index.aspx 
    DocumentRoot /var/www/vhosts/example.com/subdomains/myapp/httpdocs/ 

    # MonoServerPath can be changed to specify which version of ASP.NET is hosted 
    # mod-mono-server1 = ASP.NET 1.1/mod-mono-server2 = ASP.NET 2.0 
    # For SUSE Linux Enterprise Mono Extension, uncomment the line below: 
    # MonoServerPath myapp.example.com "/opt/novell/mono/bin/mod-mono-server2" 
    # For Mono on openSUSE, uncomment the line below instead: 
    MonoServerPath myapp.example.com "/usr/bin/mod-mono-server2" 
    #mod-mono-server2 

    # To obtain line numbers in stack traces you need to do two things: 
    # 1) Enable Debug code generation in your page by using the Debug="true" 
    # page directive, or by setting <compilation debug="true" /> in the 
    # application's Web.config 
    # 2) Uncomment the MonoDebug true directive below to enable mod_mono debugging 
    MonoDebug myapp.example.com true 
    # The MONO_IOMAP environment variable can be configured to provide platform abstraction 
    # for file access in Linux. Valid values for MONO_IOMAP are: 
    # case 
    # drive 
    # all 
    # Uncomment the line below to alter file access behavior for the configured application 
    MonoSetEnv myapp.example.com MONO_IOMAP=all 
    # 
    # Additional environtment variables can be set for this server instance using 
    # the MonoSetEnv directive. MonoSetEnv takes a string of 'name=value' pairs 
    # separated by semicolons. For instance, to enable platform abstraction *and* 
    # use Mono's old regular expression interpreter (which is slower, but has a 
    # shorter setup time), uncomment the line below instead: 
    # MonoSetEnv myapp.example.com MONO_IOMAP=all;MONO_OLD_RX=1 
    MonoApplications myapp.example.com "/:/var/www/vhosts/example.com/subdomains/myapp/httpdocs/" 

    <Location "/"> 
    Order allow,deny 
    Allow from all 
    MonoSetServerAlias myapp.example.com 
    SetHandler mono 
    SetOutputFilter DEFLATE 
    SetEnvIfNoCase Request_URI "\.(?:gif|jpe?g|png)$" no-gzip dont-vary 
    </Location> 
    <IfModule mod_deflate.c> 
    AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript 
    </IfModule> 

    ErrorLog /var/www/vhosts/example.com/subdomains/myapp/logs/error.log 
    CustomLog /var/www/vhosts/example.com/subdomains/myapp/logs/access.log combined 

</VirtualHost> 

¿Alguien me puede ayudar.

Gracias de antemano, Tim

+0

Has aceptado una respuesta, pero no he dejado ningún comentario, así que supongo que hizo el trabajo, ¿no? – mbx

Respuesta

5

¿Usted ha intentado el mod_mono AutoConfiguration feature? Este es claramente el mejor enfoque con la pila Apache/Mono/ASP.NET. Con él, ya no necesita definir todas las configuraciones de Mono en su host virtual.

Aquí está mi archivo mod_mono.conf (en Mac OS X 10.7.2 y Linux Ubuntu 11.04, esto debe ser compatible con su distribución Debian):

<IfModule mono_module> 
    AddType application/x-asp-net .config .cs .csproj .dll .resources .resx .sln .vb .vbproj 
    AddType application/x-asp-net .asax .ascx .ashx .asmx .aspx .axd .browser .licx .master .rem .sitemap .skin .soap .webinfo 

    MonoAutoApplication enabled 
    MonoDebug false 
    MonoServerPath "/usr/bin/mod-mono-server4" 
    MonoSetEnv LANG=fr_FR.UTF-8 
    MonoUnixSocket "/tmp/.mod_mono" 

    <IfModule dir_module> 
     DirectoryIndex Default.aspx 
    </IfModule> 

    <DirectoryMatch "/(bin|App_Code|App_Data|App_GlobalResources|App_LocalResources)/"> 
     Order deny,allow 
     Deny from all 
    </DirectoryMatch> 

    <Location "/Mono"> 
     Order deny,allow 
     Deny from all 
     Allow from 127.0.0.1 ::1 
     SetHandler mono-ctrl 
    </Location> 
</IfModule> 

La directiva más importante es la "MonoAutoApplication" uno. Y aquí es un host virtual de la muestra:

<VirtualHost *:80> 
    ServerName www.monorules.fr 
    DocumentRoot "/Library/WebServer/Documents/MonoRules" 
</VirtualHost> 

Como se puede ver, la máquina virtual se reduce a su mínima expresión. Las configuraciones definidas en el archivo mod_mono.conf son compartidas por todos los hosts virtuales.
El único inconveniente de esta solución es que no permite reiniciar solo una instancia de un sitio ASP.NET (como en Microsoft IIS). Si utiliza el panel de control Mono (consulte la sección "Ubicación") para reiniciar el proceso, todas las aplicaciones ASP.NET se reinician.

+0

Gracias. Esto funcionó para mí. – Reinaldo

1

Si ha instalado mod mono correctamente y está habilitado en apache2, la siguiente configuración debería funcionar con su servidor virtual.

<VirtualHost *:80> 
ServerName myapp.example.com 
    ServerAdmin [email protected] 
    DirectoryIndex index.html index.aspx 
    DocumentRoot /var/www/vhosts/example.com/subdomains/myapp/httpdocs/ 

AddMonoApplications myapp.example.com "/:/var/www/vhosts/example.com/subdomains/myapp/httpdocs/" 
MonoServerPath myapp.example.com "/usr/bin/mod-mono-server2" 

<Directory /var/www/vhosts/example.com/subdomains/myapp/httpdocs/> 
    MonoSetServerAlias myapp.example.com 
    SetHandler mono 
    AddHandler mod_mono .aspx .ascx .asax .ashx .config .cs .asmx 
    <FilesMatch "\.(gif|jp?g|png|css|ico|xsl|wmv|zip)$"> 
     SetHandler None 
    </FilesMatch> 
    Options Indexes FollowSymLinks MultiViews 
    AllowOverride All 
    Order allow, deny 
    Allow from all 
    DirectoryIndex index.aspx 
</Directory> 
</VirtualHost> 
+0

¡Muchas gracias! Otra pregunta es, ¿cómo lograr que la aplicación funcione cuando accedo a DNSADRESS/mvctest/public_html, por ejemplo? –

Cuestiones relacionadas