Heim >Backend-Entwicklung >PHP-Tutorial >nginx+uwsgi+Python python.org pythonxy python3.
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>
然后将编译出来的 uwsgi 复制到系统目录
<code><span>cp</span> ./uwsgi /usr/bin/</code>
3.配置nginx
<code>vim /etc/nginx/nginx<span>.conf</span></code>
在末尾添加 include /etc/nginx/sites-enabled/*.conf;
然后新建 sites-enabled 文件夹,并创建 tzw0745.cn.conf
参考资料:Nginx+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>
4.配置uwsgi站点
在站点根目录建立uwsgi启动配置文件,如
<code><span>uwsgi</span>><span>pythonpath</span>>/var/www/tzw0745<span><span>pythonpath</span>></span> #网站根目录 <span>module</span>>run<span><span>module</span>></span> #主文件 <span>callable</span>>app<span><span>callable</span>></span> #程序入口 <span>socket</span>>127.0.0.1:9090<span><span>socket</span>></span> #监听端口 <span>processes</span>>1<span><span>processes</span>></span> #线程数 <span>py-autoreload</span>>1<span><span>py-autoreload</span>></span> #自动重载 <span><span>uwsgi</span>></span></code>
5.其他
<code>uwsgi -<span>x</span> abc<span>.xml</span> -d uwsgi<span>.log</span> killall -<span>9</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教程有兴趣的朋友有所帮助。