博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
centos django nginx uwsgi
阅读量:5964 次
发布时间:2019-06-19

本文共 2242 字,大约阅读时间需要 7 分钟。

django configuration

settings.py

DEBUG = FalseALLOWED_HOSTS = ['*']TEMPLATES = [    {        ...        'DIRS': [os.path.join(BASE_DIR, 'static')],        ...    }   ]STATIC_URL = '/static/'STATIC_ROOT = os.path.join(BASE_DIR, 'static')MEDIA_URL = '/media/'MEDIA_ROOT = os.path.join(BASE_DIR, 'media')

uwsgi configuration

cd /usr/local/project/mysitetouch uwsgi.logtouch uwsgi.socktouch uwsgi.pidtouch uwsgi.ini

vim uwsgi.ini

[uwsgi]chdir=/usr/local/project/mysite/module=mysite.wsgi:applicationworkers=5pidfile=/usr/local/project/mysite/uwsgi.pidhttp=127.0.0.1:8001static-map=/static=/usr/local/project/mysite/staticuid=rootgid=rootmaster=truevacuum=truethunder-lock=trueenable-threads=trueharakiri=30post-buffering=4096daemonize=/usr/local/project/mysite/uwsgi.logsocket=/usr/local/project/mysite/uwsgi.sock

nginx configuration

vim /etc/nginx/nginx.conf

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

vim /etc/nginx/conf.d/mysite.conf

upstream django {    server 127.0.0.1:8001;}server {    listen      80;    server_name server_name;    access_log  /var/log/nginx/access.log;    error_log   /var/log/nginx/error.log;    charset     utf-8;    gzip on;    gzip_types text/plain application/x-javascript text/css text/javascript application/x-httpd-php application/json text/json image/jpeg image/gif image/png application/octet-stream;    error_page  404           /404.html;     error_page   500 502 503 504  /50x.html;    client_max_body_size 75M;    location /media/ {        alias /ur/local/project/mysite/media/;    }    location /static/ {        alias /usr/local/project/mysite/static/;    }    location / {        include uwsgi_params;        uwsgi_connect_timeout 30;        uwsgi_pass unix:/usr/local/project/mysite/uwsgi.sock;    }}

转载于:https://www.cnblogs.com/otfsenter/p/8952504.html

你可能感兴趣的文章
webgl像机世界
查看>>
php正则怎么使用(最全最细致)
查看>>
课后作业03-验证课件上的代码,并将所有的动手动脑或要求发表博客作业部分整理成一篇博客...
查看>>
html 学习
查看>>
tomcat如何利用waf进行防护
查看>>
2017最新教程--如何下载美拍视频
查看>>
Hadoop 学习总结之三:Map-Reduce入门(转载)
查看>>
node 搭建开发框架express
查看>>
loadrunner-2-8HTML和URL模式
查看>>
RabbitMQ封装实战
查看>>
SQL Server VALUES 使用一记住
查看>>
原码、反码、补码、移码
查看>>
js禁止网页使用右键
查看>>
javascript数学运算符
查看>>
eclipse安装Run-Jetty-Run插件,修改实时生效
查看>>
UIGestureRecognizer
查看>>
NSDate 时间
查看>>
敏捷开发方法综述
查看>>
天。鬼。法
查看>>
linux tcp中time_wait
查看>>