zoukankan      html  css  js  c++  java
  • nginx(1.10.1)+uwsgi+django简单配置

    nginx版本是1.10.1

    1.安装好nginx1.10.1

    2.安装好uwsgi

    3.这是我的项目目录

      

    4.我的adms目录下有uwsgi_d.xml和uwsgi_s.xml和wsgi.py文件

      uwsgi_d.xml是开发环境xml配置

      uwsgi_s.xml是生产环境xml配置

    5.看一下uwsgi_d.xml配置

      

    <uwsgi>
        <socket>:8088</socket>
        <http>0.0.0.0:8091</http>
        <master>true</master>
        <pythonpath>/home/kevin/project_group/trunk/project110/units/adms</pythonpath>
        <module>wsgi</module>
        <processes>2</processes>
    </uwsgi>

      (1)socket--->:8088这里端口要与nginx下uwsgi_pass的端口一致

      (2)http--->0.0.0.0:8091这个是浏览器访问端口

      (3)pythonpath---->wsgi.py的绝对路径

      (4)module---->wsgi

      (5)processes--->进程数量

    6.nginx配置

      

     cd /etc/nginx/
    vim nginx.conf

      

      server {
        listen 80;
        server_name localhost;

        access_log /home/kevin/log/access.log;
        error_log /home/kevin/log/error.log;

        location /media/ {
         alias /home/kevin/project_group/trunk/project110/units/adms/mysite/media/;
        }
        location /static/ {
          alias /home/kevin/project_group/trunk/project110/units/adms/mysite/static/;
        }


        location / {
          include uwsgi_params;
          uwsgi_pass 127.0.0.1:8088;

        }
      }

     

      在nginx.conf里的http里面加入以上代码

        (1)listen 80 nginx监听端口

        (2)server_name localhost  服务器ip地址或者链接地址

        (3)access_log和error.log  2个日志文件绝对路径目录,目录要先创建好

        (4)location /media/ {}   转发的请求/media/   这里就填alias就好了,后面接路径绝对路径media的绝对路径,

        (5)location /static/ {}   转发的请求/static/   这里就填alias就好了,后面接路径绝对路径media的绝对路径,

        (6)location / {}  转发/请求, uwsgi_pass 127.0.0.1:8088这里8088端口和uwsgi_d.xml里的socket端口一致

      检查nginx有没有语法错误

      

    nginx -t

      没有错误,重启nginx

    service nginx restart

    7.启动uwsgi

      

    nohup uwsgi -x uwsgi_d.xml

      -x 使用配置文件

      

    service nginx restart
  • 相关阅读:
    animation动画应用--android游戏开发
    Codeforces Round #203 (Div. 2)
    Codeforces Round #206 (Div. 2)
    Codeforces Round #204 (Div. 2): C
    Codeforces Round #204 (Div. 2): B
    Codeforces Round #204 (Div. 2): A
    Codeforces Round #205 (Div. 2) : D
    Codeforces Round #205 (Div. 2) : C
    Codeforces Round #205 (Div. 2) : B
    Codeforces Round #205 (Div. 2) : A
  • 原文地址:https://www.cnblogs.com/wangmin0216/p/6202028.html
Copyright © 2011-2022 走看看