首頁  >  文章  >  後端開發  >  nginx+uwsgi+Python python.org pythonxy python3.

nginx+uwsgi+Python python.org pythonxy python3.

WBOY
WBOY原創
2016-07-29 08:54:141055瀏覽

1.安裝nginx並加入腳本

<code>yum <span>install</span> nginx</code>

腳本參考資料:centos下nginx啟動腳本和chkconfig管理

2.編譯uwsgi

<code>wget http://projects<span>.unbit</span><span>.it</span>/downloads/uwsgi-<span>2.0</span><span>.6</span><span>.tar</span><span>.gz</span>
tar zxvf uwsgi-<span>2.0</span><span>.6</span><span>.tar</span><span>.gz</span>
cd uwsgi-<span>2.0</span><span>.6</span>
make</code>

然後將編譯後

<code><span>cp</span> ./uwsgi /usr/bin/</code>

在末尾加上include /etc/nginx/sites-enabled/*.conf;

然後新建 sites-enabled 資料夾,並建立 tzw0745.cn.conf

參考資料:Nginx+uWSGI安裝與設定
參考設定檔:

<code>vim /etc/nginx/nginx<span>.conf</span></code>

4.設定uwsgi站點

在站點根目錄建立uwsgi啟動設定文件,如

<code>server {
    listen       <span>80</span>;
    server_name  tzw0745.cn;
    location / {            
        <span><span>include</span>  uwsgi_params;</span>
        uwsgi_pass <span>127.0</span><span>.0</span><span>.1</span>:<span>9090</span>;
    }
}</code>

5.其他

<code><span><<span>uwsgi</span>></span><span><<span>pythonpath</span>></span>/var/www/tzw0745<span></<span>pythonpath</span>></span> #网站根目录
<span><<span>module</span>></span>run<span></<span>module</span>></span>                      #主文件
<span><<span>callable</span>></span>app<span></<span>callable</span>></span>                  #程序入口
<span><<span>socket</span>></span>127.0.0.1:9090<span></<span>socket</span>></span>           #监听端口
<span><<span>processes</span>></span>1<span></<span>processes</span>></span>                  #线程数
<span><<span>py-autoreload</span>></span>1<span></<span>py-autoreload</span>></span>          #自动重载
<span></<span>uwsgi</span>></span></code>

').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i

').text(i)); }; $numbering.fadeIn(1700); }); }); 以上就介紹了nginx+uwsgi+Python,包含了python,nginx方面的內容,希望對PHP教學有興趣的朋友有幫助。

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn