Nginx uWsgi Django
시스템 환경: Ubuntu 14.04LTS
Nginx
공식 홈페이지: http://nginx.org/
설치
1.
<code><span>$sudo</span> apt<span>-get</span> install nginx</code>
주소: http://nginx.org/en/download.html
종속 라이브러리 설치
<code><span>$tar</span> zxvf nginx<span>-</span><span>1.8</span><span>.0</span><span>.</span>tar<span>.</span>gz <span>$cd</span> nginx<span>-</span><span>1.8</span><span>.0</span> $<span>.</span>/configure <span>--</span><span>with</span><span>-pcre</span><span>--</span><span>with</span><span>-http_ssl_module</span><span>--</span><span>with</span><span>-http_realip_module</span><span>--</span><span>with</span><span>-http_gzip_static_module</span><span>--</span><span>with</span><span>-http_secure_link_module</span><span>--</span><span>with</span><span>-http_stub_status_module</span><span>--</span><span>with</span><span>-debug</span><span>$make</span><span>$sudo</span> make install</code>
<code>whereis nginx</code>
nignx를 시작할 때 인식할 수 없는 명령이 발생하면 nginx 모듈이 설치되지 않은 것으로 나타났습니다.
<code><span>$sudo</span> apt<span>-get</span> install nginx<span>-core</span></code>
<code><span>sudo</span> nginx</code>
nginx의 기본 설정 인터페이스는 시작이 성공했음을 의미합니다
nginx에 오신 것을 환영합니다
<code><span>$sudo</span> nginx <span>#$sudo nginx -s start</span></code>
<code><span>$sudo</span> nginx <span>-s</span> stop</code>
<code><span>$sudo</span> nginx <span>-s</span> reload</code>
<code><span>$sudo</span> apt<span>-get</span> install uwsgi<span>-plugin</span><span>-python</span><span>$sudo</span> apt<span>-get</span> install uwsgi</code>
압축해제, 구성, 컴파일, 설치
<code><span>$tar</span> zxvf uwsgi-<span>2.0</span><span>.6</span>.tar.gz <span>$cd</span> uwsgi-<span>2.0</span><span>.6</span><span>$sudo</span><span>python</span> setup.py install</code>
<code><span>$uwsgi</span> --version</code>
<code><span><span>def</span><span>application</span><span>(env, start_response)</span>:</span> start_response(<span>'200 OK'</span>, [(<span>'Content-Type'</span>,<span>'text/html'</span>)]) <span>return</span> [<span>b"Hello World"</span>]</code>
<code><span>$uwsgi</span><span>-</span><span>-</span><span>http</span><span>:9090</span><span>-</span><span>-</span><span>wsgi</span><span>-</span><span>file</span><span>test</span><span>.</span><span>py</span></code>
<code>http:<span>//localhost:9090/</span></code>
해당 스크립트 실행
닫기:
<code><span>$killall</span><span>-</span><span>9</span> uwsgi <span>$killall</span><span>-s</span> HUP /<span>var</span>/www/uwsgi <span>$killall</span><span>-s</span> HUP /usr/<span>local</span>/bin/uwsgi </code>
<code><span>$sudo</span> apt<span>-get</span> install python2<span>.7</span></code>
압축 풀기, 구성, 컴파일, 설치
<code><span>$tar</span> zxvf Django-<span>1.8</span><span>.4</span>.tar.gz <span>$cd</span> Django-<span>1.8</span><span>.4</span><span>$sudo</span><span>python</span> setup.py install</code>
<code><span>$python</span><span>>></span><span>import</span> django <span>>></span>django<span>.</span>VERSION (<span>1</span>,<span>8</span>,<span>4</span>, <span>'final'</span>, <span>0</span>)</code>
참고http://uwsgi-docs.readthedocs.org/en/latest/WSGIquickstart.html
http://segmentfault.com/q/1010000002523354
http://www.nowamagic.net/academy/detail/1330331
http://www.nowamagic.net/academy/detail/1330334
http://www.linuxidc.com/Linux/2014-09/106928.htm