Home >Backend Development >PHP Tutorial >nginx+uwsgi+Python python.org pythonxy python3.

nginx+uwsgi+Python python.org pythonxy python3.

WBOY
WBOYOriginal
2016-07-29 08:54:141076browse

1. Install nginx and add script

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

Script reference: nginx startup script and chkconfig management under centos

2. Compile 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>

Then copy the compiled uwsgi to the system directory

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

3. Configure nginx

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

Add include /etc/nginx/sites-enabled/*.conf;
at the end Then create a new sites-enabled folder and create tzw0745.cn.conf
Reference: Nginx+uWSGI installation and configuration
Reference configuration file:

<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. Configure uwsgi site

Create a uwsgi startup configuration file in the site root directory, such as

<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>

5. Others

<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); }); });

The above has introduced nginx+uwsgi+Python, including python and nginx. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn