在线精品99_中国九九盗摄偷拍偷看_91免费版在线观看_91.app_91高清视频在线_99热最新网站

nginx如何启动和关闭?nginx启动命令和停止命令

166次阅读
没有评论

共计 2036 个字符,预计需要花费 6 分钟才能阅读完成。

nginx 如何启动和关闭?Nginx 是一个高性能的 HTTP 和反向代理服务器,特点是占用内存少,并发能力强,事实上 Nginx 的并发能力确实在同类型的网页服务器中表现较好。使用 Nginx 的过程中,我们可能总是需要修改 Nginx 配置文件,然后不停地启动或者停止 Nginx 服务,本文为大家整理汇总了 nginx 启动命令和停止命令。

一、启动 Nginx 服务

启动 Nginx 非常简单。只需运行以下命令:

sudo systemctl start nginx

成功执行后,该命令不会产生任何输出。

如果您使用的发行版上没有安装 systemd , 可以通过以下命令启动:

sudo service start nginx

除了手动启动 Nginx 服务,建议将其设置为在系统启动时自动启动,通过以下命令进行设置:

sudo systemctl enable nginx

二、停止 Nginx 服务

即使存在打开的连接,停止 Nginx 也会快速关闭所有 Nginx 工作进程。

要停止 Nginx,请运行以下命令之一:

sudo systemctl stop nginx

如果您使用的发行版上没有安装 systemd , 可以通过以下命令停止:

sudo service stop nginx

三、重启 Nginx 服务

重启是一种先停止然后再启动 Nginx 服务器的快速方法。

使用以下命令执行 Nginx 重新启动:

sudo systemctl restart nginx

如果您使用的发行版上没有安装 systemd , 可以通过以下命令重启:

sudo service restart nginx

这些是您可能最常使用的命令。

四、重载 Nginx 配置文件

当您更改其 Nginx 配置时,您都需要重新加载或重新启动 Nginx。重新加载选项将加载新配置,使用新配置启动新的工作进程并正常关闭旧工作进程。服务并不会中断。

要重新加载 Nginx 配置,请使用以下命令:

sudo systemctl reload nginx

如果您使用的发行版上没有安装 systemd , 可以通过以下命令重载:

sudo service reload nginx

五、测试 Nginx 配置

每当您更改 Nginx 服务器的配置文件时,最好在重新启动或重新加载服务之前测试配置。

使用以下命令测试 Nginx 配置是否存在任何语法或系统错误:

sudo nginx -t

输出类似如下:

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok

nginx: configuration file /etc/nginx/nginx.conf test is successful

如果有任何错误,命令将打印详细消息。

六、查看 Nginx 状态

要检查 Nginx 服务的状态,请使用以下命令:

sudo systemctl status nginx

输出结果类似如下:

nginx.service – A high performance web server and a reverse proxy server

Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)

Active: active (running) since Sun 2019-07-18 10:57:01 PDT; 5min ago

Docs: man:nginx(8)

Process: 4491 ExecStop=/sbin/start-stop-daemon –quiet –stop –retry QUIT/5 –pidfile /run/nginx.pid (code=exited, status=0/SUCCESS)

Process: 4502 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)

Process: 4492 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)

Main PID: 4504 (nginx)

Tasks: 3 (limit: 2319)

CGroup: /system.slice/nginx.service

|-4504 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;

|-4516 nginx: worker process

`-4517 nginx: worker process

结果中的 Active: active (running) 显示了 Nginx 运行状态。

七、检查 Nginx 版本

有时您可能需要知道 Nginx 的版本,以便调试问题或确定某个功能是否可用。

您可以通过运行以下方式检查您的 Nginx 版本:

sudo nginx -v

和小写 - v 不同使用参数 - V 选项将输出 Nginx 版本以及 configure 选项,注意这个是大写的 V。

sudo nginx -V

正文完
 
丸趣
版权声明:本站原创文章,由 丸趣 2023-06-12发表,共计2036字。
转载说明:除特殊说明外本站除技术相关以外文章皆由网络搜集发布,转载请注明出处。
评论(没有评论)
主站蜘蛛池模板: 九九综合九九 | 国产性色强伦免费视频 | 在线视频不卡国产在线视频不卡 | 免费人成毛片动漫在线播放 | 中文无码伦av中文字幕 | 久久精品国产av一区二区三区 | 成人精品一区二区www | 全程粗语对白视频videos | 久久黄色免费电影 | 亚洲av精品一区二区三区 | 国产91精品不卡在线 | 免费一区二区三区 | 好吊视频一区二区三区 | 久久久久久爱 | 久久精品无码免费不卡 | 一道久在线无码加勒比 | a级毛片毛片免费观看久 | 免费网站国产 | 欧美最猛的24k毛片视频 | 成人毛片免费观看视频在线 | 亚洲国产精品a一区 | 国产精品久久无码一区 | 伊人婷婷综合缴情亚洲五月 | 久久久久久影院 | 亚洲精品一区二区三区蜜桃 | 亚洲国产精品一区二区第四页 | 中文字幕日韩在线 | 国产福利在线网址成人 | 中文字幕网伦射乱中文 | 色黄视频在线观看 | 又污又爽又黄的网站 | 一区二区三区精品视频 | 亚洲精品午夜aaa级久久久久 | 国产特黄特色的大片观看免费视频 | 乱老女人一二区视频 | 岛国大片激情做爰视频 | 一级片免费观看视频 | 亚洲一区二区三区欧美 | 夜夜添无码一区二区三区 | 国产成a人亚洲精品无码樱花 | 91久久精品日日躁夜夜躁欧美 |