以下の単純な python スクリプト、hellocgi.py があります。
import sys
sys.stdout.write("Content-type: text/html \r\n\r\n")
sys.stdout.write("<!doctype html><html><head><title>Hello CGI</title></head>")
sys.stdout.write("<body><Hello CGI</h2></body></html>")
ファイルはディレクトリに配置されます
/Users/MyName/cgi-bin
次に、権限を変更します
chmod +x hellocgi.py
そして走る
python -m CGIHTTPServer
Serving HTTP on 0.0.0.0 port 8000 ...
でブラウザーを開くと、次のhttp://localhost:8000/cgi-bin/hellocgi.py,
ようになります。
Error response
Error code 404.
Message: No such CGI script ('/cgi-bin/hellocgi.py').
Error code explanation: 404 = Nothing matches the given URI.
誰が何が起こっているのか教えてもらえますか? /Library/WebServer/CGI-Executables でスクリプトのペースを調整しようとしましたが、うまくいきません。
ありがとう