Ladon configure on an existing virtualhost problem

Asked by nelko

Hi All,

I have a virtual host (use apache2) (Ubuntu) with a Mono server. I tried to configure ladon this virtual host , but it doesn't work.
Then I tried to create an other virtual host for ladon, but it doesn't work.
I can't find any desciption about this topicm just http://ladonize.org/, but is'n not working on my pc :(
Can anybody help me?

Thanks

Question information

Language:
English Edit question
Status:
Solved
For:
ladon Edit question
Assignee:
No assignee Edit question
Solved by:
nelko
Solved:
Last query:
Last reply:
Revision history for this message
jsgaarde (jakob-simon-gaarde) said :
#1

Hi Nelko

Have you read the the configuration guide at:
http://ladonize.org/index.php/Python_Configuration
It describes how to setup a Ladon service on Apache2.

/ Jakob

Revision history for this message
nelko (szabonelli) said :
#2

Hi,

I have read this, but it doesn't work on my pc...

Revision history for this message
nelko (szabonelli) said :
#3

Hi Jacob,

I'm writing my total apache2 config, because I can't find out what is the problem.

my site path: /home/www/virtual/pythonservice.local
In this directory are the handler.py and my web service file (vmi.py).

I set up all package that you wrote.
By the way my web service (vmi.py) worked with
ladon2.7ctl testserve command.

So, into the /etc/apache2/sites-available directory I have created a 'pythonservice.local' file:
<VirtualHost *:9005>
        ServerAdmin webmaster@localhost
        ServerName pythonservice.local
        DocumentRoot /home/www/virtual/pythonservice.local
        WSGIScriptAlias / /home/www/virtual/pythonservice.local/handler.py

        <Directory /home/www/virtual/pythonservice.local>
                Order allow,deny
                Allow from all
        </Directory>
        ErrorLog /var/log/apache2/pythonservice_error.log
</VirtualHost>
---------------
In the /etc/apache2 directory I have a ports.conf file
(I added lines:
NameVirtualHost *:9005 and
Listen 9005):

# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default
# This is also true if you have upgraded from before 2.2.9-3 (i.e. from
# Debian etch). See /usr/share/doc/apache2.2-common/NEWS.Debian.gz and
# README.Debian.gz

NameVirtualHost *:80
NameVirtualHost *:9000
NameVirtualHost *:9005
Listen 80
Listen 9000
Listen 9005

<IfModule mod_ssl.c>
    # If you add NameVirtualHost *:443 here, you will also have to change
    # the VirtualHost statement in /etc/apache2/sites-available/default-ssl
    # to <VirtualHost *:443>
    # Server Name Indication for SSL named virtual hosts is currently not
    # supported by MSIE on Windows XP.
    Listen 443
</IfModule>

<IfModule mod_gnutls.c>
    Listen 443
</IfModule>
---------------------
And finally in the /etc/apache2 directory I have a httpd.conf file:

 Include mods-available/mod_mono.conf
 Include mods-available/wsgi.conf

 MonoServerPath testwww /usr/bin/mod-mono-server2
 Alias dWebService "/home/www/virtual/testwww.local"
# MonoApplication "/AspNetOnApache:/usr/share/doc/xsp/test"
AddMonoApplications dWebService "/:/home/www/virtual/testwww.local"
AddType application/x-asp-net .aspx .ashx .asmx .asax .config .ascx .svc .cs

 LoadModule mono_module /usr/lib/apache2/modules/mod_mono.so
 Loadmodule wsgi_module /usr/lib/apache2/modules/mod_wsgi.so

 WSGIScriptAlias / /home/www/virtual/pythonservice.local/handler.py
 Alias pythonservice "/home/www/virtual/pythonservice.local"
 AddType text/html .py

<Location pythonservice>
 SetHandler wsgi-script
</Location>

<Location dWebService>
 SetHandler mono
 MonoSetServerAlias dWebService
</Location>

----------
My handler.py (as you show in the tutorial):

from ladon.server.wsgi import LadonWSGIApplication
application=LadonWSGIApplication(['vmi'],['/home/www/virtual/pythonservice.local'])

-------------
My web service file (vmi.py):

from ladon.ladonizer import ladonize
class Vmi():
  @ladonize(int,rtype=int)
  def msg(self,i):
        return i+1

Revision history for this message
Carlos Jenkins Pérez (carlos.jenkins) said :
#4

1) What happens when you restart apache?

sudo invoke-rc apache2 restart?

2) What happens when you point your browser service url?

http://localhost:9005/

3) What can you read in error log?

/var/log/apache2/pythonservice_error.log

Needs more diagnosis info.

Kind regards

Revision history for this message
nelko (szabonelli) said :
#5

>>1) What happens when you restart apache?

 * Restarting web server apache2 [Thu May 10 10:32:28 2012] [warn] module mono_module is already loaded, skipping
[Thu May 10 10:32:28 2012] [warn] module wsgi_module is already loaded, skipping
[Thu May 10 10:32:28 2012] [warn] The Alias directive in /etc/mono-server2/mono-server2-hosts.conf at line 11 will probably never match because it overlaps an earlier Alias.
 ... waiting ..[Thu May 10 10:32:31 2012] [warn] module mono_module is already loaded, skipping
[Thu May 10 10:32:31 2012] [warn] module wsgi_module is already loaded, skipping
[Thu May 10 10:32:31 2012] [warn] The Alias directive in /etc/mono-server2/mono-server2-hosts.conf at line 11 will probably never match because it overlaps an earlier Alias.
[Thu May 10 10:32:31 2012] [crit] (13)Permission denied: Failed to attach to existing dashboard, and removing dashboard file '/tmp/mod_mono_dashboard_XXGLOBAL_1' failed (Operation not permitted). Further action impossible.
[Thu May 10 10:32:31 2012] [crit] (13)Permission denied: Failed to attach to existing dashboard, and removing dashboard file '/tmp/mod_mono_dashboard_XXGLOBAL_1' failed (Operation not permitted). Further action impossible.
                                                                                                                                                                                                  [ OK ]

>>2) What happens when you point your browser service url?
404 Not found...

>>3) What can you read in error log?
[Thu May 10 10:37:19 2012] [error] [client 192.168.0.77] File does not exist: /home/www/virtual/pythonservice.local/handler.py/

Revision history for this message
jsgaarde (jakob-simon-gaarde) said :
#6

Did you get this working?

[Thu May 10 10:37:19 2012] [error] [client 192.168.0.77] File does not exist: /home/www/virtual/pythonservice.local/handler.py/

WSGIScriptAlias does not point to a specific script but to a script directory. The configuration article at ladonize.org does a little trick forcing requests to a certain script, but this only works if you have a path alias other than "/" (root).

You should go and read about WSGI Directives at mod_wsgi's documentation page:
http://code.google.com/p/modwsgi/wiki/ConfigurationGuidelines

What you need is to setup a Directory in combination with a normal Alias directive, something like this:

http://paste.kde.org/482276/

Best Regards
Jakob Simon-Gaarde

Revision history for this message
nelko (szabonelli) said :
#7

Hi,

My configuration was good, just something DNS setting was missing, but our system administrator solved it, and now the server is working.