I can not run the cgi script on the server ..
#!/bin/env python3 print("Content-type: text/html;charset=utf-8") print() print("<h1>Hello world!</h1>") ls:
root@server:/var/www# ls -l cgi-bin -rwxrwxrwx 1 www-data www-data 107 окт 19 17:58 1.py log:
Serving HTTP on 0.0.0.0 port 8000 ... 770.70.802.360 - - [19/Oct/2016 18:38:26] code 403, message CGI script is not a plain file ('/cgi-bin/') 770.70.802.360 - - [19/Oct/2016 18:38:26] "GET /cgi-bin/ HTTP/1.1" 403 - 770.70.802.360 - - [19/Oct/2016 18:38:37] "GET /cgi-bin/1.py HTTP/1.1" 200 - Traceback (most recent call last): File "/usr/lib/python3.5/http/server.py", line 1135, in run_cgi os.execve(scriptfile, args, env) PermissionError: [Errno 13] Permission denied: '/var/www/cgi-bin/1.py' 77.87.102.36 - - [19/Oct/2016 18:38:37] CGI script exit status 0x7f00 server run like this:
python3 -m http.server --cgi when trying to open a file through a browser, it offers to download this file ..
rights are everywhere 777 .. the www-data group is also everywhere ... what could it be? why Permission denied ?
/bin/env? A better way is to specify/usr/bin/python3. Try explicitly as awww-datauser to execute thesudo -u www-data /var/www/cgi-bin/1.pyscriptsudo -u www-data /var/www/cgi-bin/1.py- jfs