当前位置:   首页安装配置香港主机Nginx日常维护命令有哪些_代码进程

香港主机Nginx日常维护命令有哪些_代码进程

发布日期:2021-12-16 17:50 | 文章来源:gibhub

Nginx是一款比较常用的开源、高性能、高可靠的Web和反向代理程序,主要安装于主机Linux系统,需要通过命令维护和管理。这篇文章主要介绍了Nginx日常维护如Nginx启动、重启、关闭等常用命令,需要的朋友可以参考下。一、简明Nginx常用命令1、启动Nginx代码如下:poechant@ubuntu:sudo ./sbin/nginx2、停止Nginx代码如下:poechant@ubuntu:sudo ./sbin/nginx -s stoppoechant@ubuntu:sudo ./sbin/nginx -s quit-s都是采用向Nginx发送信号的方式。3、Nginx重载配置代码如下:poechant@ubuntu:sudo ./sbin/nginx -s reload上述是采用向Nginx发送信号的方式,或者使用:代码如下:poechant@ubuntu:service nginx reload4、指定配置文件代码如下:poechant@ubuntu:sudo ./sbin/nginx -c /usr/local/nginx/conf/nginx.conf-c表示configuration,指定配置文件。5、查看Nginx版本有两种可以查看Nginx的版本信息的参数。第一种如下:代码如下:poechant@ubuntu:/usr/local/nginx$ ./sbin/nginx -vnginx: nginx version: nginx/1.0.0另一种显示的是详细的版本信息:代码如下:poechant@ubuntu:/usr/local/nginx$ ./sbin/nginx -Vnginx: nginx version: nginx/1.0.0nginx: built by gcc 4.3.3 (Ubuntu 4.3.3-5ubuntu4)nginx: TLS SNI support enablednginx: configure arguments: --with-http_ssl_module --with-openssl=/home/luming/openssl-1.0.0d/6、检查配置文件是否正确代码如下:poechant@ubuntu:/usr/local/nginx$ ./sbin/nginx -tnginx: [alert] could not open error log file: open() "/usr/local/nginx/logs/error.log" failed (13: Permission denied)nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok2012/01/09 16:45:09 [emerg] 23898#0: open() "/usr/local/nginx/logs/nginx.pid" failed (13: Permission denied)nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed如果出现如上的提示信息,表示没有访问错误日志文件和进程,可以sudo(super user do)一下:代码如下:poerchant@ubuntu:/usr/local/nginx$ sudo ./sbin/nginx -tnginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is oknginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful如果显示如上,则表示配置文件正确。否则,会有相关提示。7、显示帮助信息代码如下:poechant@ubuntu:/user/local/nginx$ ./sbin/nginx -h或者:代码如下:poechant@ubuntu:/user/local/nginx$ ./sbin/nginx -?以上这些涵盖了 Nginx 日常维护的所有基本操作,另外还有向 master 进程发送信号的相关命令,我们会在下面看到。二、在Linux下通过master发送信号的相关命令停止操作停止操作是通过向nginx进程发送信号(什么是信号请参阅linux文 章)来进行的步骤1:查询Nginx主进程号ps -ef | grep nginx在进程列表里 面找master进程,它的编号就是主进程号了。步骤2:发送信号从容停止Nginx:kill -QUIT 主进程号快速停止Nginx:kill -TERM 主进程号

版权声明:本站部分内容来源于网友推荐、互联网收集整理而来,仅供学习参考,不代表本站立场,如有内容涉嫌侵权,请联系alex-e#qq.com处理。

联系我们
关于使用场景和技术架构的更多咨询,请联系我们的销售和技术支持团队。
Yingsoo Host

在线
客服

在线客服:7*24小时在线

客服
热线

400-630-3752
7*24小时客服服务热线

关注
微信

关注官方微信
顶部