centos下安装supervisor的步骤详解
本篇文章给大家带来的内容是关于centos下安装supervisor的步骤详解,有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助。
1、安装supervisor
执行以下命令
yum install python-setuptools easy_install supervisor
或者
#如果easy_install不好使就从官方下载: wget https://pypi.python.org/packages/80/37/964c0d53cbd328796b1aeb7abea4c0f7b0e8c7197ea9b0b9967b7d004def/supervisor-3.3.1.tar.gz #然后通过python安装: tar zxf supervisor-3.3.1.tar.gz cd supervisor python setup.py install
2、配置Supervisor
a.创建文件夹和配置文件
mkdir /etc/supervisor echo_supervisord_conf > /etc/supervisor/supervisord.conf
b.修改/etc/supervisor/supervisord.conf文件内容
在文件结尾[include]节点处
把;files = relative/directory/*.ini
改为files = conf.d/*.conf
c.执行supervisorctl reload命令使配置文件生效。
d.在/etc/supervisor/下创建conf.d文件夹,及ProjectName.conf(以项目名称命名的)
e.打开laravel.conf文件,添加内容如下:
[program:laravel] process_name=%(program_name)s_%(process_num)02d command=/usr/local/php/bin/php /data/wwwroot/laravel/artisan queue:listen --tries=3 autostart=true autorestart=true user=www numprocs=2 redirect_stderr=true stdout_logfile=/data/wwwlogs/worker.log
3、运行supervisord,查看是否生效,执行以下命令:
#运行 supervisord -c /etc/supervisor/supervisord.conf #查看进程 (ps -ef | grep ProjectName) ps -ef|grep laravel
4、配置supervisord开机启动
a.在指定目录下创建文件supervisord.service
vim /usr/lib/systemd/system/supervisord.service
b.输入以下内容:
[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
c.执行以下命令:
systemctl enable supervisord
d.验证是否为开机启动:
#提示 enabled 表示成功 systemctl is-enabled supervisord
5、常用命令
service supervisord start #启动 service supervisord stop #停止 service supervisord status #状态 supervisorctl shutdown #关闭所有任务 supervisorctl stop|start program_name #启动或停止服务 supervisorctl status #查看所有任务状态
以上是centos下安装supervisor的步骤详解的详细内容。更多信息请关注PHP中文网其他相关文章!

热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

AI Hentai Generator
免费生成ai无尽的。

热门文章

热工具

记事本++7.3.1
好用且免费的代码编辑器

SublimeText3汉化版
中文版,非常好用

禅工作室 13.0.1
功能强大的PHP集成开发环境

Dreamweaver CS6
视觉化网页开发工具

SublimeText3 Mac版
神级代码编辑软件(SublimeText3)

热门话题

在 Linux 中启动 Nginx 的步骤:检查 Nginx 是否已安装。使用 systemctl start nginx 启动 Nginx 服务。使用 systemctl enable nginx 启用在系统启动时自动启动 Nginx。使用 systemctl status nginx 验证启动是否成功。在 Web 浏览器中访问 http://localhost 查看默认欢迎页面。

确认 Nginx 是否启动的方法:1. 使用命令行:systemctl status nginx(Linux/Unix)、netstat -ano | findstr 80(Windows);2. 检查端口 80 是否开放;3. 查看系统日志中 Nginx 启动消息;4. 使用第三方工具,如 Nagios、Zabbix、Icinga。

启动 Nginx 服务器需要按照不同操作系统采取不同的步骤:Linux/Unix 系统:安装 Nginx 软件包(例如使用 apt-get 或 yum)。使用 systemctl 启动 Nginx 服务(例如 sudo systemctl start nginx)。Windows 系统:下载并安装 Windows 二进制文件。使用 nginx.exe 可执行文件启动 Nginx(例如 nginx.exe -c conf\nginx.conf)。无论使用哪种操作系统,您都可以通过访问服务器 IP

服务器无权访问所请求的资源,导致 nginx 403 错误。解决方法包括:检查文件权限。检查 .htaccess 配置。检查 nginx 配置。配置 SELinux 权限。检查防火墙规则。排除其他原因,如浏览器问题、服务器故障或其他可能的错误。

如何解决 Nginx 403 Forbidden 错误?检查文件或目录权限;2. 检查 .htaccess 文件;3. 检查 Nginx 配置文件;4. 重启 Nginx。其他可能原因还包括防火墙规则、SELinux 设置或应用程序问题。

问题的答案:304 Not Modified 错误表示浏览器已缓存客户端请求的最新资源版本。解决方案:1. 清除浏览器缓存;2. 禁用浏览器缓存;3. 配置 Nginx 允许客户端缓存;4. 检查文件权限;5. 检查文件哈希;6. 禁用 CDN 或反向代理缓存;7. 重启 Nginx。

在 Linux 中,使用以下命令检查 Nginx 是否已启动:systemctl status nginx根据命令输出进行判断:如果显示 "Active: active (running)",则 Nginx 已启动。如果显示 "Active: inactive (dead)",则 Nginx 已停止。

错误日志位于 /var/log/nginx(Linux)或 /usr/local/var/log/nginx(macOS),使用命令行清理步骤:1. 备份原日志;2. 创建空文件作为新日志;3. 重启 Nginx 服务。也可使用第三方工具(如 logrotate)或配置自动清理。
