安装NGINX
跟python的编译安装一摸一样1
2
3
4
5tar -xf nginx-1.13.9.tar.gz
cd nginx-1.13.9/
./configure --prefix=/usr/nginx
make
make install
修改配置文件
禁止后台启动,否则supervisor无法监控,出现nginx不停重启的问题1
daemon off;
编写配置文件
1 | location / { |
nginx相关命令
1 | 重启nginx:/usr/nginx/sbin/nginx -s reopen |
安装supervisor
1 | tar -xf supervisor-3.3.3.tar.gz |
服务端指令:supervisord
客户端指令:supervisorctl
服务端执行配置文件:supervisord -c /home/startsh/supervisord.conf
supervisor的配置文件里加入
1 | [program:HT-NGINX] |
supervisor常用命令
客户端执行配置文件:supervisorctrl -c /home/startsh/supervisord.conf1
2
3
4
5
6
7
8help # 查看帮助
status # 查看程序状态
reread # 更新配置,不重启应用
update # 重启配置改动的应用
stop program_name # 关闭 指定的程序
start program_name # 启动 指定的程序
restart program_name # 重启 指定的程序
tail -f program_name # 查看 该程序的日志
阿里云、腾讯云SSH经常自动断开
修改 /etc/ssh/sshd_config1
2ClientAliveInterval 30
ClientAliveCountMax 86400
重启sshd服务:
1 | /bin/systemctl restart sshd.service |
启动nginx时报错
1 | [root@VM_81_66_centos ~]# /usr/nginx/sbin/nginx -c /home/startsh/nginx.conf |
解决方法:1
2
3http {
include /usr/nginx/conf/mime.types; //补全,填写含有mime.types的路径
default_type application/octet-stream;