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

后端 未结 6 1783
再見小時候
再見小時候 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:31

    In my case, I made a mistake with my ScriptAlias directive. I uncommented the original one, but forgot to configure a new one.

    As soon as I correctly changed and saved my sites-available/default config file from this:

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    
    

    .. to this:

    ScriptAlias /cgi-bin/ /var/www/cgi-bin/
    
    

    .. and reloaded apache2, it just worked: it stopped displaying my scripts as text, and started running them as a script. Also, it no longer displayed /var/www/cgi-bin as a directory in the browser, but now correctly displays the error:

    Forbidden 
    You don't have permission to access /cgi-bin/ on this server.
    

提交回复
热议问题