zoukankan      html  css  js  c++  java
  • Django nginx部署

    配置环境

    安装Python3
    1、安装gcc,用于编译Python源码
    yum install gcc
    2、下载源码包,https://www.python.org/ftp/python/
    3、解压并进入源码文件
    4、编译安装
    ./configure
    make all
    make install
    模式:/usr/local/bin/python3
    

     安装Django

     

    1
    pip3 install django==1.11.7

    如果报错:no module _sqlite3
      yum install sqlite-devel

    nginx

    安装

    1
    yum install nginx

    配置

    user root;
                        worker_processes 4;
    
                        error_log /var/log/nginx/error.log;
                        pid /var/run/nginx.pid;
    
                        events {
                            worker_connections  1024;
                        }
    
    
                        http {
                            log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                                              '$status $body_bytes_sent "$http_referer" '
                                              '"$http_user_agent" "$http_x_forwarded_for"';
    
                            access_log  /var/log/nginx/access.log  main;
    
                            sendfile            on;
                            tcp_nopush          on;
                            tcp_nodelay         on;
                            keepalive_timeout   65;
    
                            include             /etc/nginx/mime.types;
                            default_type        application/octet-stream;
    
                            upstream django {
                                server 127.0.0.1:8001; 
                            }
                            server {
                                listen      80;
    
                                charset     utf-8;
    
                                # max upload size
                                client_max_body_size 75M;
    
                                location /static {
                                    alias  /data/s9deploy/allstatic; 
                                }
    
                                location / {
                                    uwsgi_pass  django;
                                    include     uwsgi_params;
                                }
                            }
                        }

     

     

    uwsgi

    
    
    1
    pip3 install uwsgi







     
     
  • 相关阅读:
    Spring Boot 应用监控
    学习学习SpringSecurity
    Spring Cloud 简介
    thinkphp 请求
    八、主从复制
    七、AOF 持久化
    五、五大数据类型实现原理
    六、RDB 持久化
    四、redis的底层数据结构
    三、五大数据类型详细用法
  • 原文地址:https://www.cnblogs.com/liusouthern/p/8066471.html
Copyright © 2011-2022 走看看