linux下利用nginx部署python网站
首先目标机器需要安装python nginx uwsgi,其次,需要给Nginx写配置文件,大体内容如下,
具体内容可见 http://blog.cn2p.com/web-server/nginx-uwgsi-python.html 比较具体。
server {
#修改监听端口
listen 80;
#修改域名
server_name zone4j.com;
#301重定向
if ($host != ‘zone4j.com’) {
rewrite ^/(.*)$ http://zone4j.com/? permanent;
}
#charset koi8-r;
#access_log /var/log/nginx/log/host.access.log main;
#动态内容,将http协议转uWSGI协议,转发给uWSGI处理
location / {
include uwsgi_params;
uwsgi_pass 127.0.0.1:8023;
}
#静态内容nginx直接处理
location ~.*(html|css|js|gif|jpg|jpeg|png|bmp|ico|txt)$ {
root /var/www/html;
}
#404
error_page 404 /404.html;
location = /404.html {
root /var/www/html;
}
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
然后用Uwsgi执行server.py 文件(必须在项目的根目录文件下),命令如下 uwsgi_python3 -s 0.0.0.0:8080 --file server文件的绝对路径
最新文章
- 【Git】error: RPC
- 如何在latex 中插入EPS格式图片
- 【翻译svg教程 】svg 的坐标系统
- Could not obtain information about Windows NT group/user 'xxxx\xxxx', error code 0x5
- jquery工具类函数
- [ACM_动态规划] 最长上升子序列(LIS)
- poj1631Bridging signals(最长单调递增子序列 nlgn)
- js中的相等与不等运算
- .NET Linq/MVC/架构
- Relax信息学题库须知
- String 经常用法最优算法实现总结 (二)
- Windows Server2012R2 安装 SharePoint 2013 的必备组件
- javascript 跨域 的几种方法
- FTP 150 Opening BINARY mode data connection for MLSD 读取目录列表失败
- 安卓开发之Room实体定义数据
- SAP SQVI 快速浏览器
- PHP从入门到精通(三)
- oracle 之 创,增,删,改操作
- vue-12-渲染函数 &; JSX
- css outline实践研究
热门文章
- 函数式编程Map()&;Reduce()
- 【C51】单片机定时器介绍
- [LeetCode]题解(python):078 Subsets
- 【转】使用git、git-flow与gitlab工作
- http://blog.csdn.net/pi9nc/article/details/23169357
- box_shadow
- Chrome控制台调试工具用法
- Android设计模式源码解析之外观模式(Facade)
- Java Lock ReentrantLock ReentrantReadWriteLock
- shell中引用其他脚本的方法