服務器相關

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

?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
【社區(qū)內容提示】社區(qū)部分內容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

友情鏈接更多精彩內容