用supervisor+nginx部署服务的流程
来源:互联网 发布:网络上说的吃鸡是什么 编辑:程序博客网 时间:2024/06/15 02:13
以chat_service为例:
1,将项目拷贝至某一路径<your_path>
2,更改supervisor配置文件:supervisor.conf(一般在/etc/目录下)
- 在/etc/supervisor.d/目录下新建chat_service.conf配置文件,如下:[program:chat_service]
command=/usr/local/bin/gunicorn -b 0.0.0.0:8001 -w 40 -k gevent -t 300 chat_service.wsgi:application
directory=/home/hongkeyuan/chat/bin/chat_system/chat_service
autostart=true
autorestart=true
redirect_stderr=true
stdout_logfile=/home/hongkeyuan/chat/log/chat_service.log
stderr_logfile=/home/hongkeyuan/chat/log/chat_service.err - 将配置文件包含到supervisor.conf中,在supervisor.conf中加入:[include]
files = /etc/supervisor.d/*.conf
3,更改nginx配置文件,/etc/nginx/conf.d/目录下新建chat_service.conf配置文件,如下:
upstream chat_service {
server localhost:8001;
}
server {
listen 8000;
location /static {
alias /home/robot/chat/bin/chat_system/chat_service/static;
}
location / {
proxy_pass_header Server;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_pass http://chat_service;
}
}
server localhost:8001;
}
server {
listen 8000;
location /static {
alias /home/robot/chat/bin/chat_system/chat_service/static;
}
location / {
proxy_pass_header Server;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_pass http://chat_service;
}
}
4,重新加载supervisor:supervisorctl -c /etc/supervisor.conf reload,此时配置的服务也将重启。
5,重新加载nginx:nginx -s reload。
tips:1,如果需要sudo权限,相关命令前需要加sudo。2,这里nginx主要起重定向作用,如果不需要重定向,则无需配置nginx。
阅读全文
1 0
- 用supervisor+nginx部署服务的流程
- python+Tornado + Supervisor + nginx部署
- python+Tornado + Supervisor + nginx部署
- python+Tornado + Supervisor + nginx部署
- ubuntu+nginx+supervisor部署tornado
- python+Tornado + Supervisor + nginx部署
- 部署项目Nginx+Tornado+Supervisor
- tornado之supervisor nginx部署
- django+nginx+supervisor+gunicorn+gevent 网站部署
- python web 部署:nginx + gunicorn + supervisor + flask
- 网站部署过程 Nginx + Gunicorn +Supervisor +Flask
- ubuntu+uwsgi+nginx+django+supervisor部署
- Flask Nginx Gunicorn Supervisor 网站部署 详解
- Ubuntu 下 WSGI + Nginx + Supervisor 部署 Flask
- django+nginx+supervisor+gunicorn+gevent 网站部署
- centos+flask+uwsgi+nginx+supervisor部署小结
- Flask:Nginx + uWSGI + Supervisor 服务器部署
- ubuntu下python+tornado+supervisor+nginx部署
- 在Centos6.9上快速搭建基于Beego和Swagger的RESTful API
- 微信小程序开发(3)---Page()函数
- 图片帮助类—ImageHelper
- ios-发动态的图片的动画实现技巧
- Spring和MyBatis环境整合
- 用supervisor+nginx部署服务的流程
- Java8 Lambda表达式 函数式编程 方法引用
- linux目录结构
- \u格式 &# unicode与汉字的相互转换
- idea破解
- Android监听解锁屏幕广播
- EJB
- lua 5.3中string.pack 与 lpack中string.pack
- Xcode多Target设置