Docker+supervisor+tomcat+nginx+php-fpm配置与注意事项

发布时间:2019-08-08 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了Docker+supervisor+tomcat+nginx+php-fpm配置与注意事项脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。

注意点:
1、使用docker启动,suPErvisor不能在后台运行,需要使用/usr/bin/supervisord -n -c/etc/supervisor/supervisord.conf(其中-n为–nodaemon)或者/usr/bin/supervisord并配置

[supervisord]
nodaemon=true

2、supervisor管理的进程不能以后台程序运行。比如ph5-FPM启动不能command=/usr/sbin/php5-fpm,而应该使用command=/usr/sbin/php5-fpm –nodaemonize

3、supervisor管理tomcat时,需要使用catalina.sh而非startup.sh原因就是不能以非后台运行。所以command=/opt/tomcat7/bin/catalina run
4、supervisor管理nginx时,由于不能管理后台进程,所以需要配置/etc/nginx/nginx.conf,在nginx.conf的顶端配置daemon off;

user www-data;
worker_PRocesses auto;
pid /run/nginx.pid;

daemon off;
...

具体配置如下:

[inet_http_server]
port=localhost:9000
username=xxxx
password=111

[supervisord]
nodaemon=true
LOGfile=/VAR/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
piDFile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir=/var/log/supervisor            ; ('AUTO' child log dir, default $TEMP)

[program:chmod]
command=/bin/bash -c "chown MySQL:mySQL -R /opt/websITe/mysqldata && chown www-data:www-data -R /opt/website/www"
[program:sshd]
command=/usr/sbin/sshd -D
[program:nginx]
command=/usr/sbin/nginx
stopsignal=QUIT
[program:php-fpm]
command=/usr/sbin/php5-fpm  --nodaemonize
stopsignal=QUIT
[program:tomcat]
command=/opt/website/tomcat7/bin/catalina.sh run
startsecs=10 
stopsignal=QUIT 
user=root

supervisor管理界面效果如下

Docker+supervisor+tomcat+nginx+php-fpm配置与注意事项

参考http://stackoverflow.com/questions/32965149/supervisord-php5-fpm-exited-too-quickly
http://serverfault.com/questions/647357/running-and-monitoring-nginx-with-supervisord

脚本宝典总结

以上是脚本宝典为你收集整理的Docker+supervisor+tomcat+nginx+php-fpm配置与注意事项全部内容,希望文章能够帮你解决Docker+supervisor+tomcat+nginx+php-fpm配置与注意事项所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。