mint下nginx和uwsgi部署django
参考:
http://www.cnblogs.com/fnng/p/5268633.html
安装Nginx
apt-get install nginx
启动Nginx:
/etc/init.d/nginx start #启动
/etc/init.d/nginx stop #关闭
/etc/init.d/nginx restart #重启
修改Nginx默认端口号
打开/etc/nginx/sites-enabled
listen 8088 default_server;
listen [::]:8088 default_server;
其中8088 自定义端口号
安装uwsgi
1.升级pip
pip install --upgrade pip
2.安装setuptools
pip install setuptools
3.安装python-dev
apt-get install python-dev
4.安装uwsgi
pip install uwsgi
安装django
pip install django
部署django
1.项目下创建配置文件myweb_uwsgi.ini
![](https://img-blog.csdnimg.cn/img_convert/47221613010d8abbb329a1353423ab02.png)
修改代码uwsgi重载:添加
py-autoreload=1
2.项目下
uwsgi --ini myweb_uwsgi.ini
3.修改/etc/nginx/sites-enabled/default
![](https://img-blog.csdnimg.cn/img_convert/7f6e2f65770d21b68c73fd79eb2d0f2e.png)
![](https://img-blog.csdnimg.cn/img_convert/1810ce840339e2f5cd4b59f149ea2a2d.png)
4.重启nginx
错误问题解决:
![](https://img-blog.csdnimg.cn/img_convert/667998a5d44a400f309ca74b86fda070.png)
参考:
http://www.cnblogs.com/94cool/p/5952219.html
安装supervisor并设置自启动(实现自启动uwsgi)
apt-get install supervisor
/etc/supervisor/conf.d/目录下新建XX.conf
——————
[program:myweb]
command=uwsgi --ini myweb_uwsgi.ini
directory=/home/js/myweb
user=www-data
——————
命令行下:
touch /var/run/supervisor.sock
chmod 777 /var/run/supervisor.sock
service supervisor restart
————————
实现自启动
修改/lib/systemd/system/supervisor.service
_______________________
[Unit]
Description=Supervisor daemon
[Service]
Type=forking
ExecStart=/usr/bin/supervisord -c /etc/supervisor/supervisord.conf
ExecStop=/usr/bin/supervisorctl shutdown
ExecReload=/usr/bin/supervisorctl reload
KillMode=process
Restart=on-failure
RestartSec=42s
[Install]
WantedBy=multi-user.target
_______________________
systemctl enable supervisor
验证一下是否为开机启动:
systemctl is-enabled supervisor
相关文章
- 金融服务领域的大数据:即时分析
- 影响大数据、机器学习和人工智能未来发展的8个因素
- 从0开始构建一个属于你自己的PHP框架
- 如何将Hadoop集成到工作流程中?这6个优秀实践必看
- SEO公司使用大数据优化其模型的5种方法
- 关于Web Workers你需要了解的七件事
- 深入理解HTTPS原理、过程与实践
- 增强分析:数据和分析的未来
- PHP协程实现过程详解
- AI专家:大数据知识图谱——实战经验总结
- 关于PHP的错误机制总结
- 利用数据分析量化协同过滤算法的两大常见难题
- 怎么做大数据工作流调度系统?大厂架构师一语点破!
- 2019大数据处理必备的十大工具,从Linux到架构师必修
- OpenCV中的KMeans算法介绍与应用
- 教大家如果搭建一套phpstorm+wamp+xdebug调试PHP的环境
- CentOS下三种PHP拓展安装方法
- Go语言HTTP Server源码分析
- Go语言HTTP Server源码分析
- 2017年4月编程语言排行榜:Hack首次进入前五十