Mac osx のデフォルトの Apache サーバーに mod_wsgi モジュールをインストールしようとしています。私はこの男のチュートリアルに従っています。モジュールを apache config に追加する部分にたどり着き、次の 2 行を挿入します。
$ sudo nano /private/etc/apache2/httpd.conf
...
LoadModule wsgi_module libexec/apache2/mod_wsgi.so
WSGIScriptAlias / /Library/WebServer/Documents/
...
ターミナルに戻り、次のように入力します。
sudo /usr/sbin/apachectl restart
ブラウザで localhost/testpy.py にアクセスすると、ローカル ホストに接続できないというエラーが表示されます。これは私のtestpy.py
ファイルです:
def application(environ, start_response):
status = ’200 OK’
output = ‘Hello World!’
response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]
編集
この 2 行のコードを追加しても、Apache エラー ログには何も生成されません。それらを取り出して、エラーログにこれを取得する前に機能していたことがわかっている URL に移動すると、次のようになります。
caught SIGTERM, shutting down
Init: Session Cache is not configured [hint: SSLSessionCache]
httpd: Could not reliably determine the server's fully qualified domain name, using my-machine.local for ServerName
Digest: generating secret for digest authentication ...
Digest: done
Apache/2.2.22 (Unix) DAV/2 PHP/5.3.15 with Suhosin-Patch mod_ssl/2.2.22 OpenSSL/0.9.8r configured -- resuming normal operations