1、nginx文件的配置

路径:/etc/nginx/conf.d/

example.conf

启动:service nginx [start]/[restart]/[stop]

upstream django {
# server unix:///path/to/your/mysite/mysite.sock; # for a file socket
server 127.0.0.1:8000; # for a web port socket (we'll use this first)
} # configuration of the server
server {
# the port your site will be served on
listen 8080;
# the domain name it will serve for
server_name django; # substitute your machine's IP address or FQDN
charset utf-8; # max upload size
client_max_body_size 75M; # adjust to taste
# Finally, send all non-media requests to the Django server.
location / {
uwsgi_pass django;
include uwsgi_params; # the uwsgi_params file you installed
} location /static{
alias /var/www/learning_web/static;
}
location /static/admin {
alias /usr/local/lib/python2.7/dist-packages/django/contrib/admin/static/admin;
} }

2、uwsgi文件的配置

在项目的根目录下面,与manage.py同目录

example_uwsgi.ini

启动:uwsgi --ini example_uwsgi.ini

# uwsgi.ini file
[uwsgi] # Django-related settings
# the base directory (full path)
chdir = /var/www/learning_web
# Django's wsgi file
wsgi-file = /var/www/learning_web/learnchinese/wsgi.py
# module = index.wsgi:application
# the virtualenv (full path)
# home = /path/to/virtualenv
daemonize = /var/www/learning_web/learnchinese/uwsgi.log
# process-related settings
# master
master = true
pidfile = /tmp/learnchinese_master.pid
# maximum number of worker processes
processes = 1
# the socket (use the full path to be safe
# socket = /home/python/ocean_monitor/ocean_monitor.sock
socket = 127.0.0.1:8000
# ... with appropriate permissions - may be needed
chmod-socket = 664
# clear environment on exit
vacuum = true

停止:

ps -aux | grep 'ecs_uwsgi.ini' | grep -v grep |cut -c 9-15|xargs kill -9

(慎用,看清杀死的进程)

Django部署uwsgi 与 nginx配置的更多相关文章

  1. Django 部署 uwsgi + nginx + supervisor

    Django 部署 uwsgi + nginx + supervisor https://hacpai.com/article/1460607620615?p=1&m=0 zonghua • ...

  2. Django部署--uwsgi配置--nginx服务器配置

    uwsgi.ini文件 [uwsgi] #使用nginx连接时使用,Django程序所在服务器地址 socket=127.0.0.1:8000 #直接做web服务器使用,Django程序所在服务器地址 ...

  3. django,uwsgi, nginx部署项目

    在liunx中环境中 对于nginx来说: 1.先安装nginx sudo apt-get install nginx 2.启动nginx服务 sudo /etc/init.d/nginx resta ...

  4. centos7.3部署django用uwsgi和nginx[亲测可用]

    现在nginx nginx version: nginx/1.10.2 uwsgi 2.0.17 django2.0.5 都已经完成完毕,那么开始 uwsgi 配置 uwsgi支持ini.xml等多种 ...

  5. flask uwsgi和nginx配置信息

    1. 安装 pip3 install uwsgi 2. uwsgi配置信息 创建一个uwsgi.ini文件 [uwsgi] socket=/opt/script/uwsgi.sock #启动程序时所使 ...

  6. Django with uWSGI and nginx

    Reference:http://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html Setting up Dja ...

  7. CentOS下 Django部署 uWSGI+Django(一)

    由于新冠疫情的缘故,公司要求员工停薪休假,赋闲在家的时候还是决定做点正事,学学习. 本人Linux入门水平,Python入门水平,所以在网上找的那些python部署的帖子,看的是云里雾里的,也没有达到 ...

  8. 杂记:Django和static,Nginx配置路径,json_schema

    前记:知识无处不在,要懂得珍惜,找到适合自己的方法高效地学习有价值的知识,不念过去,不畏将来. Django对待静态资源,在非前后端分离时的常识 Django会对项目app下的static文件夹的静态 ...

  9. windows下Django 部署到Apache24的配置

    1.首先下载最新版Apachehttp://httpd.apache.org/download.cgi#apache24,目前官方以不提供windows msi安装包,下载好的直接解压至C盘即可,ap ...

随机推荐

  1. mongodb数据修复宝典

    mongodb数据修复宝典 1. 版本信息 mongodb版本: 3.6.14 2.mongodb日志内容: 2019-10-04T10:41:38.558+0000 E STORAGE [inita ...

  2. springboot 配置将info、error、debug 分别输出到不同文件

    在resource下创建名为 logback-spring.xml 的配置文件,内容如下: <?xml version="1.0" encoding="UTF-8& ...

  3. phpstorm 方法名类名 作者日期 注释

    phpstorm 设置方法名 函数名注释  新建页面作者日期信息注释 官方提供的文档地址: http://www.jetbrains.com/phpstorm/help/creating-php-do ...

  4. 一枚Android "短信小偷" 病毒的分析

    一.样本简介 样本来自于吾爱破解论坛链接地址为http://www.52pojie.cn/thread-410238-1-1.html,样本不是很复杂有空就分析了一下.Android病毒样本还是很有意 ...

  5. Python 图片转字符图

    pip install Image argparse pillow from PIL import Image import argparse #命令行输入参数处理 parser = argparse ...

  6. 基于Neptune开发板的键盘蓝牙模块DIY指南

    目录: 1.下载开发板程序2.安装USB串口(CH340)驱动3.安装烧写工具4.烧写开发板程序 本期我们带来基于润和Neptune开发板(以下简称Neptune开发板)的键盘蓝牙模块DIY指南,利用 ...

  7. killable thread的python实现

    python没有为内置的threading.Thread类提供一个kill接口,可以通过使用CPython API向线程抛出一个SystemExit异常来终止线程.如果线程没有被系统调用阻塞(slee ...

  8. 2021最新Java面试题全集-20210326版

    在手撕了数千道网络流传的面试题,外加十多个不眠之夜, 终于从里面精心挑选出约500道题目, 做为大家求职.跳槽前复习准备面试使用. 一:挑选题目的原则: 常考的.常被面试问到的 题目有一定的深度和难度 ...

  9. Java_封装

    分类(分层)思想 dao层(数据访问层):对数据进行管理的操作(增.删.改.查). 数据库.数组.集合 service层(业务层): 具体做一些业务操作 controller(控制层): 用来接收用户 ...

  10. liunx磁盘挂载操作

    目标: 欲挂载目录:/home欲挂载磁盘:/dev/sdd 1.查看磁盘使用情况 [root@localhost ~]# df -h 文件系统 容量 已用 可用 已用% 挂载点 devtmpfs 47 ...