1. /**************************************************************************************
  2. * Ubuntu Nginx uwsgi django 初试
  3. * 说明:
  4. * 最近打算通过Python搭建一个数据收集的网站,先做一个搭建测试。
  5. *
  6. * 2016-8-5 深圳 南山平山村 曾剑锋
  7. *************************************************************************************/
  8.  
  9. 一、参考文章:
  10. . Ubuntu下搭建Nginx+Uwsgi+Python+Mysql开发环境
  11. http://blog.csdn.net/hchuchuan/article/details/49718521
  12. . 基于nginxuWSGIUbuntu上部署Django
  13. http://www.jianshu.com/p/e6ff4a28ab5a
  14. . Install uwsgi 1.2. via pip
  15. http://askubuntu.com/questions/182313/install-uwsgi-1-2-5-via-pip
  16. . How To Install the Django Web Framework on Ubuntu 14.04
  17. https://www.digitalocean.com/community/tutorials/how-to-install-the-django-web-framework-on-ubuntu-14-04
  18. . Nginx+uWSGI 入门
  19. http://my.oschina.net/u/877567/blog/201577
  20.  
  21. 二、Django目录结构:
  22. zengjf@zengjf:~/website$ pwd
  23. /home/zengjf/website
  24. zengjf@zengjf:~/website$ tree
  25. .
  26. └── mysite
  27. ├── manage.py
  28. └── mysite
  29. ├── __init__.py
  30. ├── __init__.pyc
  31. ├── settings.py
  32. ├── settings.pyc
  33. ├── urls.py
  34. ├── urls.pyc
  35. └── wsgi.py
  36.  
  37. directories, files
  38. zengjf@zengjf:~/website$
  39.  
  40. 三、nginx配置:
  41. root@zengjf:/etc/nginx/sites-available# pwd
  42. /etc/nginx/sites-available
  43. root@zengjf:/etc/nginx/sites-available# cat default
  44. # You may add here your
  45. # server {
  46. # ...
  47. # }
  48. # statements for each of your virtual hosts to this file
  49.  
  50. ##
  51. # You should look at the following URL's in order to grasp a solid understanding
  52. # of Nginx configuration files in order to fully unleash the power of Nginx.
  53. # http://wiki.nginx.org/Pitfalls
  54. # http://wiki.nginx.org/QuickStart
  55. # http://wiki.nginx.org/Configuration
  56. #
  57. # Generally, you will want to move this file somewhere, and start with a clean
  58. # file but keep this around for reference. Or just disable in sites-enabled.
  59. #
  60. # Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
  61. ##
  62.  
  63. server {
  64. listen default_server;
  65. listen [::]: default_server ipv6only=on;
  66.  
  67. root /home/zengjf/website/mysite;
  68. index index.html index.htm;
  69.  
  70. # Make site accessible from http://localhost/
  71. server_name localhost;
  72.  
  73. location / {
  74. # First attempt to serve request as file, then
  75. # as directory, then fall back to displaying a .
  76. # try_files $uri $uri/ =;
  77. include uwsgi_params;
  78. uwsgi_pass 127.0.0.1:; #必须和uwsgi中的设置一致
  79. # Uncomment to enable naxsi on this location
  80. # include /etc/nginx/naxsi.rules
  81. }
  82.  
  83. # Only for nginx-naxsi used with nginx-naxsi-ui : process denied requests
  84. #location /RequestDenied {
  85. # proxy_pass http://127.0.0.1:8080;
  86. #}
  87.  
  88. #error_page /.html;
  89.  
  90. # redirect server error pages to the static page /50x.html
  91. #
  92. #error_page /50x.html;
  93. #location = /50x.html {
  94. # root /usr/share/nginx/html;
  95. #}
  96.  
  97. # pass the PHP scripts to FastCGI server listening on 127.0.0.1:
  98. #
  99. #location ~ \.php$ {
  100. # fastcgi_split_path_info ^(.+\.php)(/.+)$;
  101. # # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
  102. #
  103. # # With php5-cgi alone:
  104. # fastcgi_pass 127.0.0.1:;
  105. # # With php5-fpm:
  106. # fastcgi_pass unix:/var/run/php5-fpm.sock;
  107. # fastcgi_index index.php;
  108. # include fastcgi_params;
  109. #}
  110.  
  111. # deny access to .htaccess files, if Apache's document root
  112. # concurs with nginx's one
  113. #
  114. #location ~ /\.ht {
  115. # deny all;
  116. #}
  117. }
  118.  
  119. # another virtual host using mix of IP-, name-, and port-based configuration
  120. #
  121. #server {
  122. # listen ;
  123. # listen somename:;
  124. # server_name somename alias another.alias;
  125. # root html;
  126. # index index.html index.htm;
  127. #
  128. # location / {
  129. # try_files $uri $uri/ =;
  130. # }
  131. #}
  132.  
  133. # HTTPS server
  134. #
  135. #server {
  136. # listen ;
  137. # server_name localhost;
  138. #
  139. # root html;
  140. # index index.html index.htm;
  141. #
  142. # ssl on;
  143. # ssl_certificate cert.pem;
  144. # ssl_certificate_key cert.key;
  145. #
  146. # ssl_session_timeout 5m;
  147. #
  148. # ssl_protocols SSLv3 TLSv1 TLSv1. TLSv1.;
  149. # ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES";
  150. # ssl_prefer_server_ciphers on;
  151. #
  152. # location / {
  153. # try_files $uri $uri/ =;
  154. # }
  155. #}
  156. root@zengjf:/etc/nginx/sites-available#
  157.  
  158. 四、运行uwsgi命令:
  159. root@zengjf:/home/zengjf/website# uwsgi --socket 127.0.0.1: --chdir /home/zengjf/website/mysite --wsgi-file mysite/wsgi.py --master --processes --threads
  160. *** Starting uWSGI 2.0.13.1 (64bit) on [Fri Aug :: ] ***
  161. compiled with version: 4.8. on August ::
  162. os: Linux-3.16.--generic #~14.04.-Ubuntu SMP Thu Jan :: UTC
  163. nodename: zengjf
  164. machine: x86_64
  165. clock source: unix
  166. pcre jit disabled
  167. detected number of CPU cores:
  168. current working directory: /home/zengjf/website
  169. detected binary path: /usr/local/bin/uwsgi
  170. uWSGI running as root, you can use --uid/--gid/--chroot options
  171. *** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
  172. chdir() to /home/zengjf/website/mysite
  173. your processes number limit is
  174. your memory page size is bytes
  175. detected max file descriptor number:
  176. lock engine: pthread robust mutexes
  177. thunder lock: disabled (you can enable it with --thunder-lock)
  178. uwsgi socket bound to TCP address 127.0.0.1: fd
  179. Python version: 2.7. (default, Jun , ::) [GCC 4.8.]
  180. Python main interpreter initialized at 0x24ae640
  181. python threads support enabled
  182. your server socket listen backlog is limited to connections
  183. your mercy for graceful operations on workers is seconds
  184. mapped bytes ( KB) for cores
  185. *** Operational MODE: preforking+threaded ***
  186. WSGI app (mountpoint='') ready in seconds on interpreter 0x24ae640 pid: (default app)
  187. *** uWSGI is running in multiple interpreter mode ***
  188. spawned uWSGI master process (pid: )
  189. spawned uWSGI worker (pid: , cores: )
  190. spawned uWSGI worker (pid: , cores: )

Ubuntu Nginx uwsgi django 初试的更多相关文章

  1. [技术博客]ubuntu+nginx+uwsgi+Django+https的部署

    ubuntu+nginx+uwsgi+Django+https部署文档 配置机器介绍 操作系统:Ubuntu 18.04.2 LTS 64位 python版本:Python 3.6.7 Django版 ...

  2. ubuntu+nginx+uwsgi部署django web项目

    前言 将本地开发的django项目部署至linux上的uwsgi服务器,并配置nginx,完成基于ubuntu+nginx+uwsgi的上线运行.下面整理相关步骤. 服务器配置virtualenv 如 ...

  3. ubuntu NGINX uwsgi https 部署Django 遇到的问题

    搞了3天终于把Django成功部署到Ubuntu,记录一下: 引用来自泡泡茶壶: Ubuntu下的Nginx + Uwsgi + Django项目部署详细流程 前提说明: Django作为小程序的后端 ...

  4. 五步教你实现使用Nginx+uWSGI+Django方法部署Django程序

    Django的部署可以有很多方式,采用nginx+uwsgi的方式是其中比较常见的一种方式. 在这种方式中,我们的通常做法是,将nginx作为服务器最前端,它将接收WEB的所有请求,统一管理请求.ng ...

  5. Nginx+uWSGI+Django+Python+ MySQL 搭建可靠的Python Web服务器

    一.安装所需工具 yum -y install gcc gcc-c++ rpm-build mysql* libtool-ltdl* libtool automake autoconf libtool ...

  6. 安装Nginx+uWSGI+Django环境

    Ubuntu Server 12.04 安装Nginx+uWSGI+Django环境 今天要介绍的是利用APT源直接apt-get install安装配置我们所需要的环境,首先按惯例先安装MySQL和 ...

  7. nginx+Uwsgi+Django总结与分析

    配置与调试nginx与uwsgi 參考: 1.uWSGI其三:uWSGI搭配Nginx使用 2.学习VirtualEnv和Nginx+uwsgi用于django项目部署 3.部署备忘 4.nginx+ ...

  8. 转载nginx+uwsgi+django

    Django的部署可以有很多方式,采用nginx+uwsgi的方式是其中比较常见的一种方式. 在这种方式中,我们的通常做法是,将nginx作为服务器最前端,它将接收WEB的所有请求,统一管理请求.ng ...

  9. nginx+uwsgi+django部署流程

    当我们在用django开发的web项目时,开发测试过程中用到的是django自带的测试服务器,由于其安全及稳定等性能方面的局限性,django官方并不建议将测试服务器用在实际生产. nginx+uws ...

随机推荐

  1. 【java 理论篇 2】J2EE的13种规范

    导读:看完了J2EE的视频,没有什么技术实践,现在就从理论上说明一下J2EE的13种规范,以及现在的自己对它的一个理解.可能会有偏差,但是,算是做为目前的一个记录. 一.13种规范 1.1.JDBC( ...

  2. 洛谷 P3800 Power收集

    题目背景 据说在红雾异变时,博丽灵梦单身前往红魔馆,用十分强硬的手段将事件解决了. 然而当时灵梦在Power达到MAX之前,不具有“上线收点”的能力,所以她想要知道她能收集多少P点,然而这个问题她答不 ...

  3. PHP 常见问题3

    1,Http 和 Https 的区别 第一:http 是超文本传输协议,信息是明文传输,https 是具有安全性的 ssl 加密传输协议 第二:http 和 https 使用的是完全不同的连接方式,端 ...

  4. js的offsetWidth,clientWidth

    js元素的offsetWidth与clientWidth很相似,因此放在一起记录. clientWidth与offsetWidth clientWidth=元素内容区域宽度+水平内边距padding. ...

  5. 2017多校Round10(hdu6171~hdu6181)

    补题进度:5/11 1001(双向BFS) 题意: 给你一个类似移子游戏,给你初始状态和终止状态,问初始状态到终止状态至少要移多少步,如果步数>20就-1 分析: 很明显的BFS了,不过普通的B ...

  6. GreenDao数据库的升级

    应用使用了GreenDao数据库,在版本升级的时候需要更改dao的字段,新增.修改.删除字段操作,如果直接删除原来的表的话那用户原来的一些数据就没有了,所以在更新数据库的时候需要做一次封装,把原来的数 ...

  7. 【stl学习笔记】vector

    vector是定义于namespace std内的template: namespace std { template<class T, class Allocator = allocator& ...

  8. HDU 1201 18岁生日 【日期】

    18岁生日 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Subm ...

  9. JAVA_the user operation is waiting怎么办

    彻底解决 MyEclipse出现the user operation is waiting的问题   2011-05-31 10:32:30|  分类: 软件编程 |  标签:java  myecli ...

  10. ascii与unicode,utf-8小结

    ascii是以一个字节存储英文和特殊字符,不支持中文的处理.unicode占用的是两个字节,可以存储中文.utf-8占用三个字节,可以根据存储的内容进行中英文的转换. Python的解释器是不支持中文 ...