Trouble running python script as cgi under apache (ubuntu 12)

后端 未结 6 1781
再見小時候
再見小時候 2021-02-07 15:31

Disclosure: I searched a lot, and I don\'t think my question (for my configuration) is answered here. For example run python script as cgi apache server doesn\'t answer it.

6条回答
  •  醉梦人生
    2021-02-07 15:32

    What could also cause these symptoms, is that you don't have the apache2 cgi module loaded. This will also generate a log message in /var/log/apache2/access.log with an HTTP 304 error:

    192.168.2.3 - - [26/Jul/2014:11:56:34 +0200] "GET /cgi-bin/hello.py HTTP/1.1" 304 179 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36"
    

    Check loaded modules with:

    apache2ctl -M
    

    Look for:

    cgid_module (shared)
    

    If it's not loaded, load it with:

    a2enmod cgid
    

    Then restart apache2:

    service apache2 reload
    

    Then refresh your browser and purge your browser cache (CTRL + F5). And/or restart your browser, to be sure it's requesting the actual page, instead of using the browser cache.

提交回复
热议问题