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>
在站點根目錄建立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教學有興趣的朋友有幫助。