Python / Apache config problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I also sent this to the python list but will try here too.   Thanks in advance for any help you can give me.

I'm using the software called "Open Freezer" which is used to track reagents and other chemicals in research labs.

I also posted this here on their discussion forums but have not heard anything yet.  

https://sourceforge.net/p/openfreezer/discussion/openfreezer/thread/789d5cdb/

It was working fine on Ubuntu 11.04 and RHEL 5.7 but I'm having issues on Ubuntu 11.11 - in all cases the versions of python + apache that come with the respective OS

In the working version on Ubuntu 11.04 the entire apache instance was dedicated to this app - something I cannot do on the RHEL and Ubuntu 11.11 machines

---snip---

The specific problem I am having is that I go to "Search Projects", and then select a project and hit "Go", and it does not execute the python. In one configuration, it downloads the .py script instead of executing it. In the other configuration it tells me 404 cannot find it. I had this working fine on RHEL 5.7 but now it is broken on Ubuntu (with the same config file)

Details below.

I had the basic CGI functions working fine on RHEL but had to move to the latest version of Ubuntu server and am having trouble. One different aspect of both my RHEL and Ubuntu setups is that I cannot dedicate the entire Apache instance to Open Freezer, so my URL is not http://MYIP/ it is http://MYIP/openfreezer/ .

On RHEL my openfreezer.conf file looks like this. Note there is no VirtualHost because as mentioned I cannot dedicate this apache instance to just open freezer, and I also do not have control over DNS so I cannot assign a 2nd DNS name to this server.

Alias        "/openfreezer"    "/var/www/OpenFreezer"
Alias        "/openfreezercgi"    "/var/www/OpenFreezer/cgi"

<Directory /var/www/OpenFreezer/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all
    #AddHandler python26-mod_python .py
    #AddHandler mod_python .py
        PythonDebug On
        #PythonHandler mod_python.publisher
</Directory>

<Directory /var/www/OpenFreezer/cgi/>
    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
    AddHandler mod_python .py
        #PythonDebug On
        PythonHandler mod_python.cgihandler
    PythonPath "['/var/www/OpenFreezer/cgi'] + sys.path"

</Directory>

This works fine on RHEL 5.7 with apache 2.2.3 . I select a project, hit "Go" and it executes cgi/project_request_handler.py as it should. But with the exact same config file on Ubuntu it instead tries to download the .py instead of execute it. But I also try putting a couple of test programs in my CGI directory. This first one tries to download as well with the above config :

test.py
def index(req):
return "Test successful";


But this second one executes correctly :

testcgi.py
#!/usr/bin/python
print "Content-type: text/html"
print
print ""
print "

Hello!
"
print ""

So I talk to the other guy here who started out working on this for us, because he had it running on Ubuntu as well (a slightly older version - 11.04 versus my 11.11). He has apache 2.2.16 and I have 2.2.20

His config file looks like this - note that he does have the entire apache server dedicated to Open Freezer so his URL is http://HISIP/

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName localhost

    DocumentRoot /var/www/OpenFreezer/
    <Directory />
        Options FollowSymLinks
        AllowOverride All
    </Directory>
    <Directory /var/www/OpenFreezer/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
        AddHandler mod_python .py
            PythonDebug On
            #PythonHandler mod_python.publisher

    </Directory>

    <Directory /var/www/OpenFreezer/cgi/>
        AllowOverride All
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
        #AddHandler mod_python .py
            #PythonDebug On
            #PythonHandler mod_python.cgihandler
    </Directory>

    #<Directory /var/www/OpenFreezer/cgi/>
        #
    #</Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.1/255.0.0.0 ::1/128
    </Directory>

</VirtualHost>

If I strip out the two Directory sections from that and make mine look the same, then instead of trying to download the .py file what I get is this error :

Not Found

The requested URL /openfreezer/cgi/project_request_handler.py was not found on this server

and checking the apache error.log that is of course a 404

But that file definitely exists at that location - no question about it.

And interestingly, now my test programs have the opposite reaction. test.py works under this config, but testcgi.py gives me the 404

So I'm just stumped at this point. I've googled everywhere loooking for help.


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux