服务器相关

django导出依赖:pip freeze > requirements.txt
pip install -r re..

aliyun:centos
uwsgi:uwsgi --ini 绝对路径ini文件
uwsgi --stop uwsgi.pid
killall -s INT uwsgi
nginx: sudo nginx -t -c 需要测试文件的绝对路径
sudo nginx -c 启动配置文件的绝对路径
sudo nginx -s quit

对接uwsgi和nginx

[uwsgi]
# 使用nginx连接时 使用
socket=0.0.0.0:8888

# 直接作为web服务器使用
# http=0.0.0.0:80
# 配置工程目录
chdir=/django-project/AXF

# 配置项目的wsgi目录。相对于工程目录
wsgi-file=AXF/wsgi.py

#配置进程,线程信息
processes=2

threads=5

enable-threads=True

master=True
# 进程id存储文件
pidfile=uwsgi.pid
# 
daemonize=uwsgi.log



user  nginx;
worker_processes  1;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    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;

    keepalive_timeout  65;

    #gzip  on;

    #include /etc/nginx/conf.d/*.conf;
    
    server {
        listen       80;
    server_name  localhost;

    root /django-project/AXF;
    
        location /static {
            #root   /usr/share/nginx/html;
        #index  index.html index.htm;

        alias /django-project/AXF/static;   
            }
    location /{
        include /etc/nginx/uwsgi_params;
        uwsgi_pass 127.0.0.1:8888;
        }
    }
}

你可能感兴趣的:(服务器相关)