uwsgi の動作確認

とりあえず uwsgi の動作確認の為に /var/www/html に hello.py を用意。

def application(env, start_response):
    start_response('200 OK', [('Content-Type','text/html')])
    return "Hello World"

で、uwsgi を起動

uwsgi --socket 127.0.0.1:9090 --file /var/www/html/hello.py

ポート 9090 へのアクセス?があったら /var/www/html/hello.py が起動される。

次に nginx.conf を修正して www.example.com/ にアクセスすると先ほど起動した uwsgi を呼び出すようにした。

        location / {
            include     uwsgi_params;
            uwsgi_pass  127.0.0.1:9090;
        }

nginx に設定を読み込ませた後で、ブラウザから www.example.com にアクセスすると…

ちゃんと表示された!