如何确定 linux 内的 php nginx mysql 进程是否运转正常

WBOY
Release: 2016-06-06 20:45:24
Original
962 people have browsed it

如题所述。

回复内容:

如题所述。

<code>ps aux | grep php
ps aux | grep nginx
ps aux | grep mysql
</code>
Copy after login

大概是这个样子?

写一个简单的 PHP 程序,连接 Mysql,可选的作一些读写操作,
然后把这个 PHP 程序配置到 Nginx 下。

使用的时候,自己 curl 这个 PHP 程序的 Web 地址,
能够返回预设结果就说明 PHP Nginx Mysql 这三个家伙的工作都是正常的。

我来补一句,对于nginx 这种服务进程,还可以用service管理...

<code class="lang-bash">service nginx status
</code>
Copy after login

ps aux | grep xx
用于查看xx进程(服务)情况

<code>netstat -atnp | grep :80
</code>
Copy after login

查看服务网络情况,两个命令配合使用。有时候服务进程正常了,可是由于防火墙问题外部还是无法访问到的,通过netstat和tcpdump等工具就大概能分析出来原因来了。

可以写个shell脚本,或者用其他语言实现。
放在定时任务,定期请求一个url请求,此请求包含php连接数据库信息,出错了给你发短信。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!