侧边栏壁纸
博主头像
★街角晚灯★博主等级

博观而约取 厚积而薄发

  • 累计撰写 438 篇文章
  • 累计创建 181 个标签
  • 累计收到 0 条评论

目 录CONTENT

文章目录

CentOS 安装 supervisor 并添加 Nginx

WinJay
2019-07-31 / 0 评论 / 0 点赞 / 139 阅读 / 2139 字 / 正在检测是否收录...
温馨提示:
文章发布较早,内容可能过时,阅读注意甄别。。。。

title: 'CentOS 安装 supervisor 并添加 Nginx' date: '2019-07-31T22:56:20+08:00'

安装直接用的 yum 安装的。。

安装完成后,修改配置文件,启用 web 访问

https://www.cnblogs.com/yjlch1016/p/10162918.html

新增监控配置文件,注意路径。

[root@NercBox var]# cd /etc/supervisord.d/
[root@NercBox supervisord.d]# ls
nginx.ini
[root@NercBox supervisord.d]# cat nginx.ini 
[program:nginx]
;directory = /usr/sbin/nginx            ;启动目录
command =  /usr/sbin/nginx             ;启动命令
autostart = true                       ;在supervisord启动的时候也启动
startsecs = 5                          ;启动5秒后没有异常退出,就当作已经正常启动了
autorestart = true                     ;程序异常退出后自动重启
startretries = 6                       ;启动失败自动重试次数,默认是3
user = root                            ;哪个用户启动
redirect_stderr = true                 ;把stderr重定向到stdout,默认false
stdout_logfile_maxbytes = 20MB         ;stdout日志文件大小,默认50MB
stdout_logfile_backups = 20            ;stdout日志文件备份数
stdout_logfile = /var/log/nginx/stdout.log 

 然后对 nginx 配置文件进行修改,加入 deanon off; 参数,注意添加位置
user  nginx;
worker_processes  1;


error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;
daemon off;                          //注意添加到此处

events {
    worker_connections  1024;
}


http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
    
    access_log  /var/log/nginx/access.log  main;
    
    sendfile        on;
    #tcp_nopush     on;
    
    keepalive_timeout  65;
    
    #gzip  on;
    
    include /etc/nginx/conf.d/*.conf;

}

然后加载 supervisor 的 nginx 程序配置文件

supervisorctl update

再次访问web,点击启动即可。

0

评论区