linux 怎么查看 nginx是否启动成功
时间: 2023-09-28 11:11:03 浏览: 1331
在 Linux 中可以通过以下命令来检查 Nginx 是否启动成功:
1. 使用 `ps` 命令查看 Nginx 进程是否存在。可以使用以下命令:
```
ps -ef | grep nginx
```
如果结果中有类似以下的输出,说明 Nginx 进程已经启动:
```
root 1234 1 0 10:15 ? 00:00:00 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
nginx 12345 1234 0 10:20 ? 00:00:00 nginx: worker process
nginx 12346 1234 0 10:20 ? 00:00:00 nginx: worker process
```
2. 使用 `systemctl` 命令查看 Nginx 服务状态。可以使用以下命令:
```
systemctl status nginx
```
如果输出中显示 `active (running)`,就说明 Nginx 服务已经启动成功了。如果显示 `inactive (dead)`,则说明服务没有启动成功或者已经被停止了。
3. 使用 `netstat` 命令查看是否有 Nginx 监听的端口。可以使用以下命令:
```
netstat -tlnp | grep nginx
```
如果输出中显示 Nginx 监听的端口号,就说明 Nginx 已经启动并监听该端口了。
以上三种方法都可以用来检查 Nginx 是否启动成功。
阅读全文
相关推荐
















