Python 部署 flask 用uwsgi和nginx
安装uwsgi nginx 具体方法请百度
1.在项目目录下建立.ini文件
xad_uwsgi.ini
[uwsgi]
master=true
#项目目录
chdir=/root/zhaoyingjie/xadconf
#虚拟环境
virtualenv=/root/zhaoyingjie/pyenv/xadconf
#module=xadserver
#plugins=python
#所需要运行的文件
mount=/=main.py
manage-script-name=true
# TODO
py-autoreload=0
lazy-apps=true
callable=app
#与nginx通信的接口
socket=127.0.0.1:5012 # TODO
#master = true
#所起几个进程
processes=8
#确保文件路径存在 存主进程号
pidfile = /root/zhaoyingjie/xadconf/xadserver_uwsgi.pid
#threads = 2 # threads=2
buffer-size=32768 #确保路径文件在
daemonize = /root/zhaoyingjie/xadconf/uwsgi.log
log-maxsize = 1000000
log-truncate = true
disable-logging = true
2配置nginx文件
在此路径下建立对应文件如果没有请自行创建 xadconf.test.com为二级域名
/etc/nginx/sites-enabled/xadconf.test.com
#xadconf.test.com 内容为
server {
listen 80;
#域名或ip
server_name xadconf.test.com;
#存放log的相对路径
root /data2/output/;
autoindex on;
location /xad_debug {
return 404;
}
location /xad_err_request {
return 404;
}
location /favicon.ico {
return 404;
}
location / {
include uwsgi_params;
uwsgi_pass 127.0.0.1:5012;
}
#存放log路径
access_log /data2/output/logs/xadconf/access.log;
error_log /data2/output/logs/xadconf/error.log;
disable_symlinks off;
charset utf-8;
}
3.在完成上面配置后,需要按以下步骤来做:重启Nginx服务器,以使Nginx的配置生效。
nginx -s reload
4.回到项目跟目录启动uwsgi
uwsgi -i XX.ini
5. ps aux | grep uwsgi 检查uwsgi的进程
6.kill -9 进程号 杀死 uwsgi的进程
Python 部署 flask 用uwsgi和nginx的更多相关文章
- python服务器环境搭建Flask,uwsgi和nginx
python服务器环境搭建Flask,uwsgi和nginx 环境配置 服务器配置 [部署系统环境Ubuntu] 使用python的Flask框架搭建好网页后台后,便要开始将网站部署到服务器平台了. ...
- windows下apache + mod_wsgi + python部署flask接口服务
windows下apache + mod_wsgi + python部署flask接口服务 用python3安装虚拟环境 为啥要装虚拟环境? 原因1:安装虚拟环境是为了使项目的环境和全局环境隔离开,在 ...
- python部署-Flask+uwsgi+Nginx
一.Flask部分(app.py) flask即Python代码:部分参考代码如下,相信很多人如果看到这篇文章一定有flask的代码能力. from app import create_app fro ...
- 阿里云服务器部署笔记二(python3、Flask、uWSGI、Nginx)
从git上把项目拉到服务器,项目可以在服务器上运行后,就只需要配置uwsgi和nginx了.它们的逻辑关系是:外部请求->nginx->uwsgi->项目实例. 一.配置uwsgi ...
- python部署到服务器(2) 一一 nginx+uwsgi+Django
参考菜鸟教程,https://blog.csdn.net/qq_42314550/article/details/81805328, 和 https://www.cnblogs.com/chenice ...
- [服务器部署] Flask + virtualenv + uWSGI + Nginx 遇到的问题
1.配置好了Flask + virtualenv +uWSGI,启动uWSGI并调试,网页显示 Internal Server Error 参考:https://www.cnblogs.com/cle ...
- 阿里云服务器部署笔记一(python3、Flask、uWSGI、Nginx)
一.重置密码,并重启服务器 二.安全组配置>配置规则>添加安全组规则(为了能在本地ssh到实例) 配置如下: 此配置为允许任意公网IP登陆实例,注意windows与Linux系统端口范围不 ...
- Django项目部署:使用uwsgi和nginx的方式
一.背景 前两天制作的个人博客网站基本完工,大致功能具备.但是在部署环节却也处处碰壁,这里也来总结以下,以备将来不时查看以及完善. 二.前提 2.1 需要的知识 django Django是一个基于p ...
- centos7.3部署django用uwsgi和nginx[亲测可用]
现在nginx nginx version: nginx/1.10.2 uwsgi 2.0.17 django2.0.5 都已经完成完毕,那么开始 uwsgi 配置 uwsgi支持ini.xml等多种 ...
随机推荐
- navicat ora-28547:connection to server failed
navicat ora-28547:connection to server failed CreationTime--2018年8月9日18点47分 Author:Marydon 1.情景还原 ...
- eclipse no java machine vitual was found
eclipse no java machine vitual was found CreateTime--2018年4月27日10:41:20 Author:Marydon 1.错误提示 2.问题 ...
- html5 效果 按下鼠标数值自动增长
<!doctype html> <html> <head> <style> * { margin:0; padding:0; } div { margi ...
- linux limits.conf 配置
转自:http://kerry.blog.51cto.com/172631/300784 limits.conf 文件实际是 Linux PAM(插入式认证模块,Pluggable Authentic ...
- PmExceptionController
package main.java.com.zte.controller.system; import java.util.ArrayList; import java.util.List; impo ...
- Oracle自治事务实际用例
如下,新建两个存储过程: 在主自治事务中,我们插入一条记录,然后在自治事务中,查看表中行数,然后尝试插入三条记录,查看行数,最后rollback 查看行数,最后返回主事务,查看行数. 1.如下代码: ...
- SVN访问版本库精细的权限控制
SVN精细权限控制本章将详细介绍前一章所涉及的两个配置文件, svnserve.conf 和 authz.conf,通过对配置逐行的描述,来阐明其中的一些细节含义.除此之外的其他配置.安装等内容,不是 ...
- request.getcontextPath() 详解(转)
本文转自:http://blog.csdn.net/pengxuan/article/details/6604578 <%=request.getContextPath()%>是为了解决相 ...
- 【LeetCode】52. N-Queens II
N-Queens II Follow up for N-Queens problem. Now, instead outputting board configurations, return the ...
- GoogleMapsV3-----基础地图(自定义消息提示OverlayView) (转)
<html> <head> <title> </title> <title></title> <style type ...